Having trouble with c++ for loops/getline | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Having trouble with c++ for loops/getline

https://code.sololearn.com/co1ociCiP7nm/?ref=app

25th Dec 2019, 10:25 PM
Bettalion
Bettalion - avatar
4 Answers
+ 1
task i created: get amount of people going to party for every person going give prompt for their name output their name and say they have been invited. use for loop problem: it doesn’t prompt the user for the first person, yet outputs that blank has been invited i think its a problem with the getline function
27th Dec 2019, 1:22 PM
Bettalion
Bettalion - avatar
0
what trouble are you having? seems to work
25th Dec 2019, 11:27 PM
grdr
0
no, it's not. it's just because of solo learn asking for all input at once. it's working as expected for me.
27th Dec 2019, 1:59 PM
grdr
0
and the last line that only prints an "a" happens because your loop is executed until x<party+1, which doesn't really make sense. remove the +1 if you mean that line. if you mean the completely empty line before the others, that's because of sololearn as I described above.
27th Dec 2019, 2:03 PM
grdr