void help_cmd()
{
cout << "help - Display list of all commands with description" << endl;
cout << "version - Displays current version " << endl;
cout << "date - Display current date or change to new date" << endl;
cout << "exit - exit out of program " << endl;
}
void version_cmd()
{
cout << "The current version is 2.0" << endl;
}
I'm not sure why it isn't working. It really doesn't make any sense. >_>
You should just do what the other user suggested until I, or another member, find working solution.
while(cmd != "exit"&& cmd != "EXIT"&& cmd != "Exit")
I should have really noticed this, and I apologize for that. You don't want to use the || operator, you want to use the && operator. That should fix the problem.
i tested and it works but why does || logic not work?
Remember that || returns true if either the right or left side of it is true
And the while loop will keep looping as long as the condition is true.
So given the below:
while(cmd != "Exit" || cmd != "EXIT")
this means the loop will keep going if
cmd != "Exit" OR cmd != "EXIT".
Which means the only way for the loop to exit would be if both of those conditions are false... which means cmd would have to be both "Exit" and "EXIT" -- which is impossible.