+ 3

String manipulation issue in C++

Hello Community, I'm having trouble with string manipulation in my C++ code here 👇 https://code.sololearn.com/ciZhBDhjDB1Y/?ref=app I would like to store names of students present using a loop and later print them to the console.

3rd Jun 2017, 9:29 PM
Tusiime Innocent Boub
Tusiime Innocent Boub - avatar
3 Answers
+ 13
It is fixed now :) https://code.sololearn.com/ch4r4g6hfgFe/?ref=app 1. name should be declared as string array 2. use getline function to take input including space 3. use getchar() between int and string input. Otherwise the ENTER (followed by the int input) will be considered as the next string input.
3rd Jun 2017, 10:37 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 9
You're welcome, @Tusiime :D
4th Jun 2017, 8:14 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 6
Thanks @Shamima Yasmin! 👏👏👏 You deserve a badge for that!
4th Jun 2017, 7:52 PM
Tusiime Innocent Boub
Tusiime Innocent Boub - avatar