Try this:
Code:
#include <iostream>
using namespace std;
int main()
{
double input;
cin >> input;
cout << input;
double input2;
cin >> input2;
cout << input2;
return 0;
}
Try typing in any string for the first input. This program will fail the same way on the next input as in your program. This is because when you attempt to read in a string ("Willy") as a double (some numerical value), cin fails.
Code:
in >> fname >> lname >> score;
string string double <- Expected
Toots Sweet 87 <- First iteration
76 90 -1 <- Second iteration
I'll leave it up to your creative intellect to figure out how to avoid reading in a string as a double in your case.