What is wrong with this code! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is wrong with this code!

Soooo, I'm creating a code that involves a if-else-if statement using user input but it's not working! It's not printing anything! https://code.sololearn.com/cHv02dEhPEOo/#cpp

19th Sep 2019, 7:59 PM
CeePlusPlus
CeePlusPlus - avatar
3 Answers
+ 2
Use getline(cin, shape); in line 7. cin will only read the first word. getline reads the whole line you entered :)
19th Sep 2019, 8:14 PM
Aaron Eberhardt
Aaron Eberhardt - avatar
+ 2
thx!
19th Sep 2019, 8:47 PM
CeePlusPlus
CeePlusPlus - avatar
+ 1
well then no of the conditions were met. maybe add an else as an default
19th Sep 2019, 8:15 PM
Anton Böhler
Anton Böhler - avatar