cin's >> operator and getline don't play well together. Formatted input treats whitespace differently than nonformatted input. More precisely, cin's >> operator leaves a newline character in the stream for getline to terminate immediately on, so it appears as if the call is being skipped. You can fix it by searching the forum for the other bazillion times this question is asked every week.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
>thanks but where do i modify the getline member function?
The point seems to be just beyond your grasp. Search the forum, and you will find the solution because it's a common question, and the answer is always the same. You don't need to modify getline at all. You need to clear the stream of crap before the call to getline.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
>cin.ignore( 2, '\n');
Feel free to replace 2 with any arbitrary number. Someone invariably pipes in with something like this, but fails to do it properly. Once again, search the forum for a better solution.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
> just put a ' cin.get (); ' at the end of the loop
This was not worth waiting 2 YEARS for.
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953