
In c++ please.
Given the sample code above in generating a random number. Create a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows.
1. When the program begins, a random number in the range of 1 through 3 is generated. If the number is 1, then the computer has chosen rock. If the number is 2, then the computer has chosen paper. If the number is 3, then the computer has chosen scissors.
(Don’t display the computer’s choice yet.)
2. The user enters his or her choice of “rock”, “paper”, or “scissors” at the keyboard.
(You can use a menu if you prefer.)
3. The computer’s choice is displayed.
4. A winner is selected according to the following rules:
a. If one player chooses rock and the other player chooses scissors, then rock wins.
(The rock smashes the scissors.)
b. If one player chooses scissors and the other player chooses paper, then scissor wins. (Scissors cuts paper.)
c. If one player chooses paper and the other player chooses rock, then paper wins.
(Paper wraps rock.)
d. If both players make the same choice, the game must be played again to determine the winner.
Use the following function prototypes to perform each major task. (please use it ty)
1. int random();
2. string input();
3. string compChoice(int);
4. void displayCompChoice(string);
5. bool compare(string, string);
note: the output should be like the Sample run. Please put the "The rock smashes the scissors" like that. Ty so much

![Given the sample code above in generating a random number. Create a program that lets the user
play the game of Rock, Paper, Scissors against the computer. The program should work as follows.
1. When the program begins, a random number in the range of 1 through 3 is generated.
If the number is 1, then the computer has chosen rock. If the number is 2, then the
computer has chosen paper. If the number is 3, then the computer has chosen scissors.
(Don't display the computer's choice yet.)
2. The user enters his or her choice of "rock", "paper", or "scissors" at the keyboard.
(You can use a menu if you prefer.)
3. The computer's choice is displayed.
4. A winner is selected according to the following rules:
a. Ifone player chooses rock and the other player chooses scissors, then rock wins.
(The rock smashes the scissors.)
b. Ifone player chooses scissors and the other player chooses paper, then scissor
wins. (Scissors cuts paper.)
c. Ifone player chooses paper and the other player chooses rock, then paper wins.
(Paper wraps rock.)
d. Ifboth players make the same choice, the game must be played again to determine
the winner.
Use the following function prototypes to perform each major task.
1. int random();
2. string input();
3. string compChoice(int);
4. void displayCompChoice(string);
5. bool compare( string, string);
Sample Run
Please enter [rock or paper or scissor]:
Enter your choice: rock
Computer choice: rock
Please enter [rock or paper or scissor]:
Enter your choice: scissor
Computer choice: rock
Please enter [rock or paper or scissor]:
Enter your choice: paper
Computer choice: rock
You win!
Paper wraps rock.
Computer wins!
Rock smashes Scissor.](https://content.bartleby.com/qna-images/question/6800b25d-7a2d-4be8-adb0-379008dddf05/4d5d2e00-ee04-4a4d-ab7e-a8ac9b09c331/2hq9cn_thumbnail.png)

Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 3 images

- LOTTERY Bill buys 10 lottery tickets which he plays randomly. Let us write a C# program for Bill that suggests random numbers for him. After the winning numbers are drawn, the program informs Bill of the results of each lottery ticket. There are 5 winning numbers in one lottery ticket. Each number is from 1 to 90.arrow_forwardProvide contrasts between circuit- and packet-switched networks to highlight their unique characteristics.arrow_forwardIn C++: Print a table that prompts the user to enter the current tuition and displays a table that displayshow many years the tuition will be doubled if the tuition is increased by 5%, 6%, and up to 10%annually. Here is a sample run: Enter the current year tuition: 20000 Rate Number of Years 5.0% 15 6.0% 12 7.0% 11 8.0% 10 9.0% 9 10.0% 8 1. Add comments throughout the program explaining your code.2. Use meaningful names for variable names.3. Submit program in .cpp filearrow_forward
- Using a Sentinel Value to Control a while Loop in Java Summary In this lab, you write a while loop that uses a sentinel value to control a loop in a Java program that has been provided. You also write the statements that make up the body of the loop. The source code file already contains the necessary variable declarations and output statements. Each theater patron enters a value from 0 to 4 indicating the number of stars the patron awards to the Guide’s featured movie of the week. The program executes continuously until the theater manager enters a negative number to quit. At the end of the program, you should display the average star rating for the movie. Instructions Ensure the file named MovieGuide.java is open. Write the while loop using a sentinel value to control the loop, and write the statements that make up the body of the loop to calculate the average star rating. Execute the program by clicking Run. Input the following: 0, 3, 4, 4, 1, 1, 2, -1 Check that the…arrow_forwardScenario: I am trying to create a recursion function that takes a number from the user. That number then goes through to equations where it squares the number and takes the square root of it. Then, that value is supposed to be sent back through the function, through the same equations. Then, I am trying to output the value of each iteration. The amount of iterations is a random number. This code is in C++ and I am using Visual Studio 2023. I have attached the code I, myself, typed and picture of the output. Also, this is a header file that is being called from my source.cpp file (case 5 in switch case). That is why I am entering 5 as the first input when I run the program. Problem: The output only shows one iteration of calculation, then goes straight back into taking an input from the user. What am I doing wrong?arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





