I wrote a small menu which is accessed from a string a user is prompted to type. After the string is sent with the return/newline key, I have a function prompting the user for a line. The problem is that when the getline is reached it immediately skips as if I entered "return" twice. Here is how it looks approximately:
1 2 3 4 5 6 7 8 9 10
string command;
cin>>command;
if (command=="option1")
{
myfunction(MyClass mc);
//etc...
}
And so it enters the function that looks like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
function (MyClass & mc)
{string first_thing;
string second_thing;
sting third_thing;
cout<<"Please enter first thing: ";
getline (cin, first_thing);
cout<<"Please enter second_thing: ";
getline (cin, second_thing);
//etc...
}
So when if type in "option1" and send it, it prompts:
Please enter first thing: Please enter second thing:
As if the first part was skipped when I typed in my first command.