View Single Post
Posts: 3,328 | Thanked: 4,476 times | Joined on May 2011 @ Poland
#1
Hi
Here's my code
Code:
int main() 
{
    clear();
    bool exit = false;
    string cmd, arg;
    while (exit == false)
    {
        cout << endl << "Type command. Type 'help' to see the comands." << endl <<
                        "> ";
        cin >> cmd;
        if (cmd == "help") showhelp(); 
        else if ( cmd == "b" || cmd == "w") wblist(cmd[0]); //as above (so below :D)
        else if (cmd == "exit") exit = true;
        else if (cmd == "restore") restore();
        else if (cmd == "backup") backup();
        else cout << "Incorrect command. Type again. Or use help by typing 'help'.";
    }
    return 0;
}
Is it possible to make input
Code:
b mediaplayer
with cin as 2 strings
but also make
Code:
exit
work

I tried

Code:
cin >> cmd >> arg;
But then I couldn't just type "exit"