Original Post
So I'm messing around trying to make a very simple console-like parser-thing and was trying to use getline() to get text from the user. Well, it'll be easier if I post the code.
while(isRunning != false)
{
getline(cin, command); // get the command from the user
if(command == "help")
{
// do "help" here
}
else if(command == "quit" || command == "exit")
{
isRunning = false;
}
else
{
cout << "Please enter a valid command. To see a list of available commands, type help.\n" << endl;
}
}
The problem is, the program runs the things under "else" as soon as it enters the while loop; it doesn't seem to wait for the first "getline." Why is this? Thanks a lot for the help.