Getline problems?

Hello, the purpose of this program is to allow users to enter a string and this
Last edited on
The extraction operator (>>) on cin leaves the newline char in the buffer, causing the next call to getline to seemingly skip. To fix this, add the following code before you call getline:

1
2
cin.sync(); //clear buffer
cin.clear(); //reset error flags, just in case 
Thanks so much!
Topic archived. No new replies allowed.