//To receive the Student information
void inputStudentInfo(string *names, int *movies, constint numStuds)
{
for(int i =0; i < numStuds; i++)
{
cout << "Enter student name: "; getline(cin, names[i]); read_string(names[i]);
cout << "Enter the number of movies for " << names[i] << ": "; cin >> movies[i]; cin.ignore(100, '\n');
}
}
//Data-Type Checking for strings
string read_string(string Sname)
{
while(!cin.good())
{
cin.clear();
cin.ignore(80, '\n');
cout <<"NOT A NAME" << endl;
}
cout << "WTF WE THOT THAT WAS A NAME!" << endl;
return Sname;
}
If I type in 3 for the Student Name, the program just proceeds forward like nothing bad happened. I know this is something simple here. What am I screwing up?
Enter Student Name: 3
WTF WE THOUGHT THAT WAS A NAME!
Enter the numbers of movies for 3: