Computer Programming Assignment: Write a Program That Selects a Number Randomly. Please Use C++. Thank you!
Inputs: 9 [int] User's Guesses
Outputs: [integer] Number of Guesses
Description:
Write a program that randomly selects a number. The program should then allow the user to enter an integer. If the number is not the randomly generated one, display whether the guess is too high or too low.
Your program should have a loop and a conditional. You are allowed to limit the range of numbers that are randomly generated, but it is not required. Once the number is randomly generated, it should remain constant throughout the program (use a constant integer variable).
Sample Outputs:
Enter a Guess: 0
Your guess was too low
Enter a Guess: 10000
Your guess was too high
Enter a Guess: 8000
Your guess was too low
Enter a Guess: 9000
Your guess was too high
Enter a Guess: 8500
Your guess was too low
Enter a Guess: 8750
Your guess was too low
Enter a Guess: 8900
Your guess was too high
Enter a Guess: 8850
Your guess was too high
Enter a Guess: 8825
Your guess was too low
Enter a Guess: 8840
Your guess was too low
Enter a Guess: 8845
Your guess was too low
Enter a Guess: 8847
Your guess was too high
Enter a Guess: 8846
You guessed the number correctly! It took you 13 attempts to guess the correct number. Press any key to continue.