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
2 Answers
+ 3
use getline() instead of cin
+ 2
you can use getline function
getline(cin,var);