Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ For this assignment youre going to write the program Rock Paper Scissors game. The user will play against the computer. A scissor can cut
C++
For this assignment youre going to write the program Rock Paper Scissors game. The user will play against the computer. A scissor can cut paper, a rock can knock a scissor, and paper can wrap a rock. One game of the Rock Paper Scissors will be such that your user will play continuously until the user or computer wins more than two times. That is, the game will stop when one of the players wins two games.
The user may play as many games as he/she likes.
- When your program begins, you should show your course header using a cout.
- Then explain how the game is played in another cout.
- Declare some variables to use in the program and also seed rand.
- Open a do-while loop as a game play loop. This is the loop that continues if the user says yes to the question, Do you want to play again?.
- Open another do-while loop. This is the round loop that runs the rock-paper-scissors game. It is needed so the player can play until the user or the computer has won twice. They have then won the round.
- Ask the user to select his/her choice (rock, paper, scissors) by displaying a menu where and asking the user to enter a number.
- After the user has entered his/her choice, the program uses a random number generator for the computers selection. There cannot be a tie, so make sure the computer number is not the same as the user number. This means using another loop, a while loop.
- Your program will evaluate who won that round.
- The program reports what the computer chose, the users choice and who won that round.
- The program s round loop will continue presenting a round until either the user or the computer has won the game.
- When the game is won, the computer announces who won the game and asks the user if they want to play another game. If the answer is yes, the program loops up to the top of the game play loop and begins again.
- If the user answers no, the program drops out of the game play loop and displays the game tally. The game tally shows number of games played and the number of wins for the player.
- After all play is completed, give a good bye message.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started