Question: C++ Please read directions, Write a program that lets the user play the game Rock, Paper, Scissors against the computer. 1.When the program begins, a

C++
Please read directions,

Write a program that lets the user play the game Rock, Paper, Scissors against the computer.

1.When the program begins, a random number in the range of 1 -3 is generated. If the number is 1, then the computer has chosen rock. 2 corresponds to paper, and 3 corresponds to scissors.

2.The user chooses rock, paper, or scissors. Use a menu with an input validation loop that maps 1 - 3 to rock, paper, scissors, and 4 to exit.

3. Start a while loop to allow the user to repeat the game or exit.

4. The player's choice is displayed.

5.The computer's choice is displayed.

6.A winner is selected using the following rules: Rock beats scissors. Scissors beats paper. Paper beats rock. If both players make the same choice, it is a tie.

7. Generate a new computer choice, asks the user for a new menu choice, and loop to play a new game if they didn't select 4 to exit.

Use the following function prototypes in your design:

// Function Prototypes int getUserChoice(); //print menu to ask user choice and return as int int getComputerChoice(); //generate random computer choice and return as int void determineWinner(int, int); //compare the two choices and print the winner (or tie) void displayChoice(int); //Print rock, paper, or scissors depending on the int parameter. Use to print the player or the computer's choice.

Thank you!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!