Search:
Forum
General C++ Programming
Issue with program.
Issue with program.
Apr 30, 2018 at 3:39am UTC
HybridXephius
(2)
*topic solved.
Last edited on
Apr 30, 2018 at 7:10pm UTC
Apr 30, 2018 at 7:07am UTC
Thomas1965
(4571)
After cin >> again the \n remains in the input buffer and getline will only read the \n and terminate.
One way to fix this is to use cin.ignore(); after cin >> again
Apr 30, 2018 at 7:12pm UTC
HybridXephius
(2)
Thank your for your help! By adding cin.ignore(); the program now ignores the newline character and the loop works correctly now.
Apr 30, 2018 at 8:10pm UTC
Ganado
(6812)
Don't delete your post after being helped. Leave it as a reference for others that might run into your same problem.
Topic archived. No new replies allowed.
C++
Information
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs