I just started learning c++, and I've encountered a problem.
I'm attempting to make it so that if I input my name, the program will say that I'm cool, but if any other name is typed it will say that they are uncool. However, even when I type in my name the program says that I am uncool. So, I was just wondering if anyone could tell me how to fix this problem. Thanks in advance.
Code:
#include <iostream>
using namespace std;
int main()
{
int name;
cout<<"Welcome to the name-judge!\n";
cout<<"Please type in your name to be judged!\n";
cin>> name;
if ( name == 'nhoJeNi' ) {
cout<<"You are very cool!\n";
}
else {
cout<<"You aren't cool!\n";
}
}
The code compiles and runs fine. But when I type "nhoJeNi," instead of saying that I'm cool, it says that I'm uncool. So, I'm doing something wrong, but I have no idea what.
Haha...I got it working...according to my reference, "equal too" is supposed to be a double "=." I took one of the "="'s out and it worked fine.
The code compiles and runs fine. But when I type "nhoJeNi," instead of saying that I'm cool, it says that I'm uncool. So, I'm doing something wrong, but I have no idea what.
Haha...I got it working...according to my reference, "equal too" is supposed to be a double "=." I took one of the "="'s out and it worked fine.