Heres a snippet of my code:
int main();
{
string cmd1;
int cmd2;
cout << "Command: " << flush;
cin >> cmd1;
if (cmd1 == "playlist")
{
cin >> cmd2;
if (cmd2==XXXXXX)
{
cout << "Illegal command: " << cmd1 << endl;
}
else
cmdPlaylist(cmd2);
}
return 0;
}
If input is playlist 6
then action would be run cmdPlaylist(6);
If input is playlist
then action would cout << "Illegal Command: " << cmd1 << endl;
My question is:
How do I get my program to print
cout << "Illegal Command: " << cmd1 << endl;
if there is no cmd2.
Is there some function I can use that states
if cmd2!=an integer
or
if cmd2!=no input/invalid
then cout << "Illegal Command: " << cmd1 << endl;