I am having some trouble getting a C++ logic loop working. From testing, I believe it is a error in the Grades()
function loop.
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.
// Grades
void Grades(char names[][length], double grades[][4])
{
for(int i = 0; i < amount; i++)
{
cout << "Name: ";
cin.ignore();
cin.getline(names[i],length, '\n');
cout << "Test Scores: ";
for(int k = 0; k < 4; k++)
{
int num = 0;
while(!(cin >> num) ||
num < 0 ||
num > 100 )
{
cout << "invalid entry." << endl;
}
grades[i][k] = num;
}
}
}