+ 2

How can be string with spaces can be entered???

cin.getline doesnt seem to work after an interger number is taken

22nd Apr 2017, 12:31 PM
Shikha
Shikha - avatar
4 Antworten
+ 1
You can also take the entire input as string, and then use the split function to separate on spaces
22nd Apr 2017, 1:16 PM
matan
+ 1
and what if i want to use only cin.getline functn.. n accept an itnteger number before entering a string
22nd Apr 2017, 5:03 PM
Shikha
Shikha - avatar
+ 1
Sorry, I did not understand what you want to do... Please explain in more details, I'll try and see if I can help
22nd Apr 2017, 7:19 PM
matan
0
string str = ""; getline(cin, str);
22nd Apr 2017, 1:11 PM
G4S