I'm trying to read a sentence using cin >> but it won't read past spaces entered by the user.
eg.
cout << "Enter Name";
cin >> name;
When user enters Joe Bloggs only Joe is stored in name.
How can i get round this?
Printable View
I'm trying to read a sentence using cin >> but it won't read past spaces entered by the user.
eg.
cout << "Enter Name";
cin >> name;
When user enters Joe Bloggs only Joe is stored in name.
How can i get round this?
try this one:
char name[20];
...
cin.getline(name,20);