String manipulation issue in C++ | Sololearn: Learn to code for FREE!


String manipulation issue in C++

Hello Community, I'm having trouble with string manipulation in my C++ code here 👇 I would like to store names of students present using a loop and later print them to the console.

6/3/2017 9:29:05 PM

Tusiime Innocent Boub

3 Answers

New Answer


It is fixed now :) 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.


You're welcome, @Tusiime :D


Thanks @Shamima Yasmin! 👏👏👏 You deserve a badge for that!