-secret message- Compiler doesn't take spaces when prompted for input | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

-secret message- Compiler doesn't take spaces when prompted for input

https://code.sololearn.com/clY9f9ZBzdI4/?ref=app I cant seem to get the compiler to recognize spaces. For some reason when add in my own string and give no input, the program runs as intended. Any feedback would be amazing! :)

24th Jun 2022, 1:41 PM
kaizhou
kaizhou - avatar
2 Answers
+ 6
cin reads only a word of input. Instead of it, use getline() or fgets() method. getline(cin, secretInput) ;
24th Jun 2022, 1:55 PM
Jayakrishna 🇮🇳
+ 1
Jayakrishna🇮🇳 Thank you so much, you're actually amazing!
24th Jun 2022, 2:01 PM
kaizhou
kaizhou - avatar