+ 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

27th Oct 2017, 1:38 PM
SUDEEP KUMAR SAHOO
SUDEEP KUMAR SAHOO - avatar
2 Answers
+ 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; }
27th Oct 2017, 4:04 PM
RZK 022
RZK 022 - avatar