0
Izzy the Iguana
Hey guys I need some help with my code for Izzy. When I set my food string manually to the 2nd test case it works but when I got it via cin it won't work. Can anybody tell me why? :) https://code.sololearn.com/cgpWo8g9uDX1/?ref=app
4 odpowiedzi
+ 1
If you want to read a whole line that contains white spaces, try to use getline()
+ 1
Replace line 12 with getline(cin, food);
The blank spaces break the input stream so only the first Carrot was read when using cin >> food;
0
nice thanks :)
0
Lisa so its better to use getline() for strings?