Strings | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Strings

#include<iostream> using namespace std; main() { char a[15]; cout<<"Input your name : "; cin>>a; cout<<"your name : "<<a; return 0; } input : this test why the output of the program just show the first word (just the word 'this')? How about if I want to show the whole sentence? Am I have to use 2 variable a and b?

23rd Sep 2017, 11:46 AM
Afif Humaidi
Afif Humaidi - avatar
2 Answers
+ 4
u can try: getline(cin, a);
23rd Sep 2017, 11:52 AM
Kawaii
Kawaii - avatar
0
thanks
24th Sep 2017, 10:26 AM
Afif Humaidi
Afif Humaidi - avatar