Code:
#include <iostream>
using namespace std;
int main()
{
char mitch;
char alex;
cout<<"Please type your name: ";
cin>> mitch;
cin>> alex;
cin.ignore();
if ( mitch ) {
cout<<"You are cool!\n";
}
else if ( alex ) {
cout<<"You are not cool!/n";
}
else {
cout<<"You are ok...\n";
}
cin.get();
}
Basically, what I want the program to do is ask the person to type their name (which I've already accomplished). Then, I want it to give a different response depending on what name they type in. If they type in "mitch", I want it to respond "You are cool!". If they type in "alex", I want it to respond "You are not cool!". And if they type in anything else, I want it to respond "You are ok...". I have it set up using an if, else if, else statement right now. The program compiles fine, but when it runs, no matter what you type in, the response is "You are cool!". Does anyone have any tips on how to get it to work right? Thanks in advance.