|
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.
|