Write a C++ program proj1.cpp that lets the user or the computer play a guessing game. The computer randomly picks a number between 1 and 100, and then for each guess the user or computer makes, the computer informs the user whether the guess was too high or too low. The program should start a new guessing game when the correct number is selected to end this run (see the sample run below). Here is a sample run of the program: Would you like to (p)lay or watch the (c)omputer play? p Enter your guess in between 1 and 100. 45 Sorry, your guess is too low, try again. Enter your guess in between 1 and 100. 58 Sorry, your guess is too low, try again. Enter your guess in between 1 and 100. 78 Sorry, your guess is too high, try again. Enter your guess in between 1 and 100. 67 Sorry, your guess is too low, try again. Enter your guess in between 1 and 100. 70 Sorry, your guess is too high, try again. Enter your guess in between 1 and 100. 68 Sorry, your guess is too low, try again. Enter your guess in between 1 and 100. 69 Congrats, you guessed the correct number, 69. Would you like to (p)lay or watch the (c)omputer play or (q)uit? c The computer's guess is 50. Sorry, your guess is too high, try again. The computer's guess is 25. Sorry, your guess is too high, try again. The computer's guess is 13. Sorry, your guess is too low, try again. The computer's guess is 19. Sorry, your guess is too high, try again. The computer's guess is 16. Sorry, your guess is too low, try again. The computer's guess is 17. Congrats, you guessed the correct number, 17. Would you like to (p)lay or watch the (c)omputer play or (q)uit? q Press any key to continue
Write a C++ program proj1.cpp that lets the user or the computer play a guessing game. The computer randomly picks a number between 1 and 100, and then for each guess the user or computer makes, the computer informs the user whether the guess was too high or too low. The program should start a new guessing game when the correct number is selected to end this run (see the sample run below).
Here is a sample run of the program:
Would you like to (p)lay or watch the (c)omputer play?
p
Enter your guess in between 1 and 100.
45
Sorry, your guess is too low, try again.
Enter your guess in between 1 and 100.
58
Sorry, your guess is too low, try again.
Enter your guess in between 1 and 100.
78
Sorry, your guess is too high, try again.
Enter your guess in between 1 and 100.
67
Sorry, your guess is too low, try again.
Enter your guess in between 1 and 100.
70
Sorry, your guess is too high, try again.
Enter your guess in between 1 and 100.
68
Sorry, your guess is too low, try again.
Enter your guess in between 1 and 100.
69
Congrats, you guessed the correct number, 69.
Would you like to (p)lay or watch the (c)omputer play or (q)uit?
c
The computer's guess is 50.
Sorry, your guess is too high, try again.
The computer's guess is 25.
Sorry, your guess is too high, try again.
The computer's guess is 13.
Sorry, your guess is too low, try again.
The computer's guess is 19.
Sorry, your guess is too high, try again.
The computer's guess is 16.
Sorry, your guess is too low, try again.
The computer's guess is 17.
Congrats, you guessed the correct number, 17.
Would you like to (p)lay or watch the (c)omputer play or (q)uit?
q
Press any key to continue
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 6 images