C++ Cout Problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

C++ Cout Problem

The code will take the input of a user and cout it back out but it only couts the first letter. How do I change this? Preferably a solution that allows any length of input https://code.sololearn.com/c04GOVIY4aM5/?ref=app

21st Feb 2019, 7:49 PM
Yosharu
Yosharu - avatar
3 Answers
+ 6
//Yosharu //you have used char test; //char means character and character means single letter, to make print whole line of characters you need string string Test; //Here is code https://code.sololearn.com/cgt6uLIffDFe/?ref=app
21st Feb 2019, 8:04 PM
Sudarshan Rai
Sudarshan Rai - avatar
+ 4
Line 6, you declared “Test” as a char, char takes only a single character, change it to string and it should work, hope this helps
21st Feb 2019, 8:04 PM
Joery De Loose
Joery De Loose - avatar
+ 3
You have the variable "Test" defined as "char", you need "string".
21st Feb 2019, 8:08 PM
Solo
Solo - avatar