Mix cin >> and cin.getline in C++ program
If the cin.getline() is used after cin >>, the getline may just get a '\0' bacause the last cin >> call left it.
How to fix it?
cin.ignore(100,'\n');
cin.getline(buffer1, 80, '\n');
How to fix it?
cin.ignore(100,'\n');
cin.getline(buffer1, 80, '\n');
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home