void getnames(string names[], int numStd)
{
for (int i = 0; i < numStd; i++)
{
cout << "Enter the name of the student #" << i + 1 << ": ";
cin.ignore();
getline(cin,names[i]);
}
}
void getScores(string names[], int scores[NUM_STUDENTS][NUM_SCORES], int numStd, int numScores)
{
for (int i = 0; i < numStd; i++)
{
cout << "Enter the grades of " << names[i] << ": " << endl;
for (int j = 0; j < numScores; j++)
{
cout << "Grade #" << j + 1 << ": ";
cin >> scores[i][j];
}
}
}
Enter the name of student #1: Angel Perez
Enter the name of student #2: Edwin la torre
Enter the grades of Angel Perez:
Grade #1: 56
Grade #2: 87
Enter the grades of dwin la torre:
Grade #1: 98
Grade #2: 78
Grades:
Angel Perez: 71
dwin la torre: 88
Press any key to continue . . .
notice how the second name isn't displaying correctly? i need that fix this NOW, I'm about to explode because I simply don't understand whats going on.
but i need cin.ignore() or i'll get something like:
Enter the name of student #1: Angel Perez
Enter the name of student #2: Enter the grades of Angel Perez:
Grade #1:
It happens every time i enter first and last names separated by a space. With the ignore, it doesn't happen, but it eats a letter -.-....any solutions?