String with space bar | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

String with space bar

If I enter blank at the input then the string is invalid. https://code.sololearn.com/c9JkXUv68Fs6/#cpp

19th May 2018, 12:48 PM
Michelle Becker
Michelle Becker - avatar
2 Answers
+ 3
use getline() instead of cin
19th May 2018, 3:47 PM
Shahd Moemen
Shahd Moemen - avatar
+ 2
you can use getline function getline(cin,var);
16th Sep 2018, 12:32 PM
himanshu k
himanshu k - avatar