This is the second time I am experiencing a problem with getline.
I've used it before successfully, but I dont know what I'm doing wrong here.
Here is the code where the problem is:
The code never waits for user input at line 6, and skips straight to the code after it. String f is totally ignored throughout the entire code, and i have included strings. What to do? How do I fix it?
I've used it before successfully, but I dont know what I'm doing wrong here.
Here is the code where the problem is:
Code:
if (a == 6)
{
string f;
int g;
cout << "Enter the message to display at the end of the countdown:" << endl;
getline (cin, f);
cout << endl;
cout << "< Enter the starting number >- ";
cin >> g;
while (g>0) {
cout << g << ", ";
--g;
}
cout << f << endl;
cout << endl;
cout << endl;
}
Comment