#include #include #include
using namespace std;
int main(){ srand(static_cast(time(0))); //seed random number generator
int secretNumber = rand() % 100 + 1; // random number between 1 and 100int tries = 0;int guess; cout << "\tWelcome to Guess My Number\n\n";<br> do{ cout << "Enter a guess: "; cin >> guess; ++tries;
if (guess > secretNumber) { cout << "Too high!\n\n"; } else if (guess < secretNumber) { cout << "Too low!\n\n"; } else { cout << "\nThat's it! You got it in " << tries << " guesses!\n"; }<br> } while (guess != secretNumber);
return 0;}