Why isnt this working?

I have some questions about how to get this to run but first i was wondering why it isnt working? it worked before?

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

using namespace std;

int main()
{
    time_t T;
    time(&T);
    srand(T);

    string input;
    int X;

    X = rand() % 101;

    cout << "Guess a number between 0 and 100" << endl;
    cout << "Your number: "; cin >> input;

    if(input == X)
    {
        cout << "You guessed exactly correct!" << endl;
    }
}


error:


C:\Users\Chay Hawk\Desktop\Guessing Game\main.cpp||In function 'int main()':|
C:\Users\Chay Hawk\Desktop\Guessing Game\main.cpp|22|error: no match for 'operator==' in 'input == X'|
||=== Build finished: 1 errors, 0 warnings ===|
input is string and X is int
Why shall this work?:)
ok thanks i forgot that part. Now, if i want to make it so the code tells the player how many numbers away they were from the guessed number but im unsure how to do it.
bump
What's the problem? You know how subtraction works, right?
If not: http://en.wikipedia.org/wiki/Subtraction
Topic archived. No new replies allowed.