Program is skipping cin.getline in loop?

Mar 24, 2015 at 7:36pm
...
Last edited on Mar 31, 2015 at 6:48pm
Mar 24, 2015 at 7:44pm
you probably need to ignore any character in the input stream by using cin.ignore() just before the cin.getline() statement.

Aceix.
Mar 24, 2015 at 7:46pm
First of all. Why are you using a character array, and then keep saying string string string, instead of just using std::string ?

To fix your problem. Try putting a cin.ignore(); just above your cin.getline
Last edited on Mar 24, 2015 at 7:47pm
Mar 24, 2015 at 7:53pm
just put cin.sync() on line 52.
Mar 24, 2015 at 8:07pm
just put cin.sync() on line 52.
Bad advice:
1) Does not on every platform
2) Even on Windows it depends on many settings (including common one which speeds up streams considerably and is often used)
Mar 24, 2015 at 8:16pm
Thanks, and noted for myself. I retract my suggestion.
Topic archived. No new replies allowed.