Sorry man forgot about something I had to do! Here it is:
Code:
#include <iostream>
using namespace std;
int main()
{
char answer[5];
while(strcmp("exit", answer))
{
cout << "Do you like sushi? Type yes or no (or exit to quit): ";
cin >> answer;
if(!strcmp("yes", answer))
{
cout << "\nWow, you like sushi!\n\n";
}
else if(!strcmp("no", answer))
{
cout << "\nGood, sushi's gross!\n\n";
}
else if(!strcmp("exit", answer))
{
cout << "\nExiting...\n\n";
}
else
{
cout << "\nWell if you can't even type yes or no..."
<< "\nhow do you expect me to trust your opinion?\n"
<< endl;
}
}
return 0;
}
I'm not sure if you've learned about while statements but they are extremely useful. It basically tells a portion of the program to keep looping until a certain case is reached. In this case it's if the user types "exit".