This:
Code:
if( y == 24){
cout << "Wow, you must be Nostradamus reincarnated.\n";
}
else
if (y < 24-11){
cout << "You're way off, don't bother trying again\n";
}
else
if (y > 21+11){
cout << "What were you thinking?\n";
}
else
if (y >= 24-10){
cout << "You're warming up\n";
}
else
if (y <= 24+10){
cout << "You're warming up\n";
}
else
if (y <= 24+5){
cout << "You're burning up\n";
}
else
if (y >= 24-5){
cout << "You're burning up\n";
}
Is more conventionally written as:
Code:
if (y == 24) {
cout << "Wow, you must be Nostradamus reincarnated.\n";
}
else if (y < 24-11){
cout << "You're way off, don't bother trying again\n";
}
else if (y > 21+11){
cout << "What were you thinking?\n";
}
else if (y >= 24-10){
cout << "You're warming up\n";
}
else if (y <= 24+10){
cout << "You're warming up\n";
}
else if (y <= 24+5){
cout << "You're burning up\n";
}
else if (y >= 24-5){
cout << "You're burning up\n";
}
It looks like you just need to add:
Code:
srand(time(0));
int x = rand() % 100; // An example for an integer in the range [0, 100)
Then change your literal 24 to x.