+ 4
Execution of cin is skipped...
While accepting a string i am unable to do it. cin>>name; this line gets skipped and the next cout works
1 Réponse
+ 4
to read a string cin>> does not work . Rather use this :
int main() {
char name[200],ch;
// or you could use char *name = new char[200];
cout<<"\n Enter your name : ";
cin.get(ch);
cin.getline(name,200);
cout<<name;
return 0;
}