my loop is not repeating correctly.

Nov 30, 2014 at 8:57pm
for loop
Last edited on Nov 30, 2014 at 11:30pm
Nov 30, 2014 at 9:19pm
Looks like there's a newline character left in the input stream after the user types 'c' and hits the enter key. That newline gets read in as the next input.

Try putting cin.ignore(); after line 69 to deal with that newline.

1
2
3
cin >> answer;
cin.ignore();
} while (answer == 'c' );
Last edited on Nov 30, 2014 at 9:20pm
Dec 1, 2014 at 12:39am
Whats the question? All you said was for loop.
Dec 1, 2014 at 1:22am
No, (s)he asked a question, got an answer and then (s)he edited the post so his/her professor wouldn't see it. It is actually pretty common on this website and frowned upon.
Topic archived. No new replies allowed.