C++ loop logic error?
<p>I am having some trouble getting a C++ logic loop working. From testing, I believe it is a error in the <code>Grades()</code> function loop.</p>

<p>Basically the program is supposed to get the Names and Test Scores, which it appears to do, but the program exits right after that and I am not sure why. Just wanting to see if anyone else noticed an error in the function that could be causing the program to terminate prematurely.</p>

<pre><code>// Grades
void Grades(char names[][length], double grades[][4])
{
    for(int i = 0; i &lt; amount; i++)
    {
        cout &lt;&lt; "Name: ";
        cin.ignore();

        cin.getline(names[i],length, '\n');

        cout &lt;&lt; "Test Scores: ";

        for(int k = 0; k &lt; 4; k++)
        {
            int num = 0;

            while(!(cin &gt;&gt; num) ||
                  num  &lt; 0 ||
                  num &gt; 100 ) 
            {
                cout &lt;&lt; "invalid entry." &lt;&lt; endl;
            }

            grades[i][k] = num;
        }
    }
}
</code></pre>
