P
Pat
I have ran into this problem numerous times during one of my C++ course.
This issue is taking in a string with spaces, for example;
#include <iostream>
#include <string>
using namespace std;
int main()
{
string userInput;
cout << "Please enter your full name: ";
cin >> userInput;
cout << "Your name is: " << userInput << endl;
return 0;
}
This is the problem the user enters the first name, space bar, and then
the last name. Hitting enter the program goes into a loop from hell and
never finishing the program.
Can anyone reference a resource or solution so that I can end this
madness of abnormal termination.
Pat
This issue is taking in a string with spaces, for example;
#include <iostream>
#include <string>
using namespace std;
int main()
{
string userInput;
cout << "Please enter your full name: ";
cin >> userInput;
cout << "Your name is: " << userInput << endl;
return 0;
}
This is the problem the user enters the first name, space bar, and then
the last name. Hitting enter the program goes into a loop from hell and
never finishing the program.
Can anyone reference a resource or solution so that I can end this
madness of abnormal termination.
Pat