Strings | Sololearn: Learn to code for FREE!



#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?

9/23/2017 11:46:25 AM

Afif Humaidi

2 Answers

New Answer


u can try: getline(cin, a);