Salem_c's Profile User Rating: ****-

Reputation: 1804 Grandmaster
Group:
Mentors
Active Posts:
3,487 (2.05 per day)
Joined:
30-May 10
Profile Views:
39,037
Last Active:
User is offline Yesterday, 11:31 PM
Currently:
Offline

Previous Fields

Country:
Who Cares
OS Preference:
Who Cares
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
0
Icon   Salem_c has not set their status

Posts I've Made

  1. In Topic: Hard time executing program using pass by value

    Posted 25 Jan 2015

    090	 else
    091	    cout << endl;
    092	        cout << "I'm sorry. That's an improper selection. Please try again.\n";
    
    

    Be aware, that contrary to your indentation, line 92 ALWAYS happens.
    It is not part of the else clause.

    Always use { } to express your intention for grouping statements.

    Also, this -> http://en.wikipedia....ki/Indent_style
    Consistency is everything.


    > while( (ans1 = 'y') || (ans1 = 'n') );
    There's a difference between = and ==
  2. In Topic: Hard time executing program using pass by value

    Posted 25 Jan 2015

    Spelling is important.
    > 117 void other_studentservices_fees( char& ans2, char& ans3 )
    vs.
    012 void other_student_services_fees( char& ans2, char& ans3 );

    Normally, you copy/paste one to the other, or you use some auto-completion feature in your editor.

    > Unit8.obj : error LNK2005: _main already defined in Tuition.obj
    It would seem that you have both Unit8.cpp and Tuition.cpp in your project.
    Edit your project (project->settings->source files) so it lists only the code you want.
  3. In Topic: invalid use of this->id, inappropriate use of Person P

    Posted 25 Jan 2015

    Look again, and count the []
  4. In Topic: invalid use of this->id, inappropriate use of Person P

    Posted 25 Jan 2015

    > 51 void display(int id, int n, Person P[])
    You didn't make this function a friend.
    It has similar looking friends.
  5. In Topic: Confusion with a dynamically sized array. C

    Posted 25 Jan 2015

    You're just going to have to produce a small minimal program which demonstrates the problem. Focussing on one small bit of code which "seems to be the problem" (by your inexpert estimation) when no obvious problem exists just isn't going to get it done.


    FWIW, your use of strtok is cumbersome, and your pointer arithmetic arcane.
      for ( tmp = strtok(buffer, delim);
            tmp != NULL && tmpItemCnt < auction->itemCount;
            tmp = strtok(NULL, delim) ) {
        tmpPrices[tmpItemCnt++] = atof(tmp);
      }
    
    

    Which also neatly includes subscript range checking as well, just in case your input data isn't all that it seems.

    You might also consider using strtod(), which can be used to walk through a string without trashing it, in the same way that strtok does. Also, strtod() has useful error information which atof() doesn't.

My Information

Member Title:
void main'ers are DOOMED
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Programming Languages:
C, C++, Perl, awk, various assemblers

Contact Information

E-mail:
Private

Comments

Page 1 of 1
  1. Photo

    fromTheSprawl Icon

    07 Sep 2012 - 02:38
    Please read my thread. I kid! Just want to say your forum avatar is awesome. ^^
  2. Photo

    Salem_c Icon

    26 Dec 2010 - 01:36
    Do not PM me for 1:1 support, or to try to get me to read your threads.
Page 1 of 1