I'm having some trouble with my second string input in my code. It works when I do it the first time, however, when I do it the second time, it skips it entirely. I copied the code the second time, but I just changed the variable name on it. Any idea's?
First time works fine
string runnerName1;
string runnerName2;
double runTime1 = 0;
double runTime2 = 0;
cout << "First Runner's Name: ";
getline(cin, runnerName1);
cout << endl;
cout << "Finishing Time: ";
cin >> runTime1;
cout << endl;
And then I add two spaces and do it again. However, it skips the runner name string input for the second name and goes straight to the finishing time
cout << "Second Runner's Name: ";
getline(cin, runnerName2);
cout << endl;
cout << "Finishing Time: ";
cin >> runTime2;
Aucun commentaire:
Enregistrer un commentaire