ive been able to make this simple else if statement work, the problem is, i keep getting the same message when i call the showcase. i want the user to enter a name or object after the word 'show', if they dont, i want a mesage to display stating so.
here is the code im using so far:
#include<iostream>
#include<string>
using namespace std;
int main()
{
string command; ;
cout <<endl;
cout << "Please enter a command." << endl;
do
{
getline(cin, command);
//event that happens if assemble filename is used as command
if (command == "build")
{
cout << "will attempt to build specified object\n";
}
//event that happens if load is used as command
else if (command == "show")
{
//checks to see what the length of the command is. if it is
//lower than 4 characters, message is shown. otherwise, another
//message gets shown.
if(command.length() > 4)
{
cout<< "will call the show function to load the specified file\n";
}
else
{
cout << "must add object name\n";
}
}
}while(command != "exit");
return 0;
}
all i get is the 'must add object name' message, or nothing gets displayed.
any help or suggestions?