If statement issue

Hello, I am trying to make a little program where you have to guess the number the computer is thinking of. However, at the if statement it showing me an error, could someone help please?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 #include <iostream>

using namespace std;

int main()

{
    int a;
    int b = 7;

    cout <<"Can you guess the number I am thinking between 1-10?";

    if(cin >>a == b)

        cout <<"Well done, you are correct!";
    else
        cout <<"You are incorrect!";



    return 0;
}
 
compiler doesn't understand your condition, so try moving cin out of your if condition:

1
2
cin >>a;
    if( a == b)


Thanks a ton man!
Topic archived. No new replies allowed.