Trouble with an if else if statement c++
<p>I am working on a grade book project that has 5 students that I want to read the names in for and then with an inner loop grab 4 grades for each student. Something is not working on this loop. This what I am getting:<br>
<br>
Please enter the name for student 1: Dave<br>
Please enter the grade number 1 for Dave: 100<br>
Please enter the grade number 2 for Dave: 100<br>
Please enter the grade number 3 for Dave: 100<br>
Please enter the grade number 4 for Dave: 10<br>
Please enter the name for student 2: James<br>
Please enter the grade number 5 for James: 100<br>
Please enter the name for student 3: Sam<br>
Please enter the grade number 5 for Sam: 100<br>
Please enter the name for student 4: Jack<br>
Please enter the grade number 5 for Jack: 100<br>
Please enter the name for student 5: Mike<br>
Please enter the grade number 5 for Mike: 100<br>
<br>
It should grab 4 grades before it jumps to the next student. I have not been able to figure this out for the last couple hours. Here is the code I have so far:<br></p>

<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt;

using namespace std;

const int STUDENTS = 5; //holds how many students we have
const int SCORES = 4;

void getNames(string names[], double student1[SCORES], double student2[SCORES],
          double student3[SCORES], double student4[SCORES], double student5[SCORES],            int SCORES, int STUDENTS);

int main()
{
    string names[STUDENTS]  = {""};
    char grades[STUDENTS]   = {""};
    double student1[SCORES] = {0};
    double student2[SCORES] = {0};
    double student3[SCORES] = {0};
    double student4[SCORES] = {0};
    double student5[SCORES] = {0};

getNames(names, student1, student2, student3, student4, student5, SCORES,  STUDENTS);


//  Make sure we place the end message on a new line
    cout &lt;&lt; endl;

//  The following is system dependent.  It will only work on Windows
    system("PAUSE");

    return 0;
}

void getNames(string names[], double student1[SCORES], double student2[SCORES],
          double student3[SCORES], double student4[SCORES], double student5[SCORES],     int SCORES, int STUDENTS)
{
     for (int i = 0; i &lt; STUDENTS; i++)
     {
         cout &lt;&lt; "Please enter the name for student " &lt;&lt; i+1 &lt;&lt; ": ";
         cin &gt;&gt; names[i];
         cout &lt;&lt; endl;

         if (i == 0)
         {
            int count1 = 0;
            for (count1; count1 &lt; SCORES; count1++)
            {
                cout &lt;&lt; "Please enter the grade number " &lt;&lt; count1+1 &lt;&lt; " for " &lt;&lt; names[i] &lt;&lt;": ";
                cin &gt;&gt; student1[count1];
                cout &lt;&lt; endl;
            }
         }
         else if (i == 1)
         {
            int count2 = 0; 
            for (count2; count2 &lt; SCORES; count2++);
            {
                cout &lt;&lt; "Please enter the grade number " &lt;&lt; count2+1 &lt;&lt; " for " &lt;&lt; names[i] &lt;&lt;": ";
                cin &gt;&gt; student2[count2];
                cout &lt;&lt; endl;
            }
         }
         else if (i == 2)
         {
            int count3 = 0; 
            for (count3; count3 &lt; SCORES; count3++);
            {
                cout &lt;&lt; "Please enter the grade number " &lt;&lt; count3+1 &lt;&lt; " for " &lt;&lt; names[i] &lt;&lt;": ";
                cin &gt;&gt; student3[count3];
                cout &lt;&lt; endl;
            }
         }
         else if (i == 3)
         {
            int count4 = 0; 
            for (count4; count4 &lt; SCORES; count4++);
            {
                cout &lt;&lt; "Please enter the grade number " &lt;&lt; count4+1 &lt;&lt; " for " &lt;&lt; names[i] &lt;&lt;": ";
                cin &gt;&gt; student4[count4];
                cout &lt;&lt; endl;
            }
         }
         else
         {
            int count5 = 0; 
            for (count5; count5 &lt; SCORES; count5++);
            {
                cout &lt;&lt; "Please enter the grade number " &lt;&lt; count5+1 &lt;&lt; " for " &lt;&lt; names[i] &lt;&lt;": ";
                cin &gt;&gt; student5[count5];
                cout &lt;&lt; endl;
            }
         }

     }
}
</code></pre>

<p>Thanks for any help on this!</p>
