#include <iostream>
#include <ctime>
#include <random>
#include <string>
usingnamespace 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 ===|
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.