View Single Post
Old 05-14-2004, 04:33 PM   #2 (permalink)
joe_bruin
LOAD "*",8,1
 
Join Date: Feb 2003
Location: la.ca.us
Posts: 254
joe_bruin is on a distinguished road
you are not handling user input correctly. you ask the user to enter 1 or 2. really, the user presses 1, and presses the enter key. so now there are two bytes in the input buffer, "1\n". your cin >> temp eats the '1', but the '\n' is still sitting in the input buffer.
when you call cin.getline(input, MAXLN);, it gets the next line from the input buffer (ie, the "\n" that was waiting for it there), and it's done.
joe_bruin is offline   Reply With Quote