I'm practicing using random number generators and making a basic math game with user input. I need help including conditions with equations. The game will display a random number and the user will be asked to double it. Thanks in advance!
int main()
{
int num;
time_t seconds;
time(&seconds);
srand((unsigned int) seconds);
num = rand() % (HIGH - LOW + 1) + LOW;
string ans;
cout << "Double the number: " << num << endl;
getline (cin,ans);
//This is where I need a condition for whether the number is correctly doubled or not.
//I know how to write 'if else' statements but not with math.
Your number is held in num. Add another variable to hold num * 2. After the user inputs the string "ans", convert the string to a number and compare that result to the variable holding the doubled number.