View Single Post
Old 01-13-2005, 03:51 PM   #8 (permalink)
toast28
Registered User
 
Join Date: Sep 2004
Posts: 21
toast28 is on a distinguished road
Now I must have some logic error in my program. I am trying to output all students grades to the screen. I get the first one out OK, but then it doesn't want to output anything after their names for students 1-x. Here is a snip of my code, if anyone can see where I went wrong logically, please tell me.

Code:
counter=0;
if (input =="*")
  {//do all students
    ID=students[counter].ID;
    first=students[counter].firstname;
    count=0;
    while(first!="")
    {
      cout << setw(12) << left << students[counter].firstname;
      cout << setw(12) << left << students[counter].lastname;
      cout << setw(6) << left << students[counter].ID;
      
      num=grades[count].classnum;
      while(num!="")
      {
        if(ID==grades[count].ID)
        {
          grade=grades[count].lettergrade;
          classnum=grades[count].classnum;
          counting=0;
          while(courses[counting].name!="")
          {
            if(courses[counting].num==classnum)
            {
              cout << setw(31) << left <<courses[counting].name;
              cout << setw(7) << left << courses[counting].num;
              cout << setw(1) << grade << endl;
              
            }//end if
            counting++;
          }//end while
        }//end if
        count++;
        num=grades[count].classnum;
      }//end while
    counter++;
    first=students[counter].firstname;
    }//end while

Last edited by Valmont; 01-14-2005 at 03:45 AM.
toast28 is offline   Reply With Quote