I am want to enter name in array and then willing to print it on screen. Code is given below
char name[20];          
cout << "Please enter name: ";
cin >> name;          
cout << name << endl;
Then after compilation I entered name
Ali Waqas
After that Ali is printed on screen but Waqas doesn’t.
I have replace my cout statement with this loop
for(int i=0; i<20; i++){
   cout << name[i];
}
Again Ali is printed but after that garbage is printing rather Waqas
 
     
    