C++ Issue

nhoJeNi

Member
Reputation
0
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";
  }
}
 
I don't see anything wrong, but I don't code C++ much :S. What error do you run across? And does the program your coding in highlight issues?
 
Post a screenshot, your syntax seems correct.
 
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.
 
nhoJeNi said:
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.



Out of curiosity, what compiler are you using?
And is it console based or GUI?
 
Ah, I see... Silly me for not seeing that!
 
ttomthebomb said:
Out of curiosity, what compiler are you using?
And is it console based or GUI?

I'm using codeblocks (GUI) with its default compiler - GNU GCC.
 
Thanks for sharing.
ps. I can do the rubik's cube consistently in 30 seconds or less :D.
 
nhoJeNi said:
ttomthebomb said:
Out of curiosity, what compiler are you using?
And is it console based or GUI?

I'm using codeblocks (GUI) with its default compiler - GNU GCC.

Oh right, that's a pretty good one. I prefer using Bloodshed Dev C++.
Fairly basic.
 
Yeah, I use Bloodshed Dev C++ at the moment. I might change...
 
Back
Top