Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your program Assignment Write a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as

Your program Assignment

Write a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows.

When the program begins, a random number is ranged 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.

(Dont display the computers choice yet.)

2. The user enters his or her choice of rock, paper, or scissors at the key-board. (You can use a menu if you prefer.)

3. Then the computers choice is displayed.

4. A winner is selected according to the following rules:

If one player chooses rock and the other player chooses scissors, then rock wins. (The rock smashes the scissors.)

If one player chooses scissors and the other player chooses paper, then scissors wins. (Scissors cuts paper.)

If one player chooses paper and the other player chooses rock, then paper wins. (Paper wraps rock.)

If both players make the same choice, the game must be played again to determine the winner.

Be sure to divide the program into functions that perform each major task. Keep track of the wins by the computer and the player and the number of ties. Display a running total when you display the winner of each round.

After each round, ask the user if they want to continue to play. Keep the program running until the user chooses to quit.

image text in transcribed

Rock-Paper-Scissors Game Your program Assignaent Example of output: Wilte a program thet lets the user play the game of Rock, Paper, Scissors gainst the computer, The program should work as follows 1, when e program begins, a random number is ranged of 1 through 3 is 1. Plan your logic before working on the profect and review the syntax you wil use in the project. Think ebout how you want the lines of output to be displayed to the user. You will want to tel the user wha the program does and what type of input you expect from the user Introduction to the User). Select names of the variables you aillu in the program If the number is 1" then te computer has chosen rock. the number is 2, then the computer has chosen paper, If the number is 3, then the computer has chosen scissors * 2. CreotE C++ project in wbual Studio 2012 . And have the code . Dont daplay the ccputer's choice yet.) window open to write the project oode. Display Using Visual Studio to create your program in C++ and follow the instructions on creating the 2. The user enters his or her cheice of rck, "paper, orscissors at the key-board, You can use a menu if you prefer.) 3. Then the conputer's choice is displared. 4. A winner is selected eccording to the fo lowing nules: e Dedare veriables to hold Information ebout USER. Using cout Sot up information sbout this program and what th .Ask the user to enter some information requested and save the response to a variable using the cout and getline(cin, name) syntax. IF the cin is used for a number, make sure you use the ignore() syntax. Hake sure the postion for the user to enter . If one player chooses rock ond the other player chcoses scissors, then . If one player chooses scissors end the other player chcoses paper * [f one player chooses peper and the other player chooses rock, then rock wina. The rock amashes the scissors then scissors wins (Sissers cuts poper Use line spacing (endl or tn) to separate lines of output to make it easy for the user to read the inforrmation . peper wins. (Paperwraps rock. [f both pleyers make the barne choice, the game must be played again to determine the winner 3. Documentation: All lines of code nsust be documented. . Use the syntax to designate lines in code as comments(/) . These comments can be at the end of a line of code or in a proup defintion at the boginning of a section of codo. All mothods and function need a group heading document. Be sure to dvide the program Into functions that pesfom each major tesk. Keep track of the wins by the computer and the player and the number of ties. Display" running total when you display the winner of och round. 4. Run the program using Ctri F5, Debug the code, making sure all caloulations are correct and the line specing is suiteble for readabilty 5. Include the looping control structure so that the user can repeot the entry of information without the program exting. Ask the user if they want to run the program agoin or exit. After each round, Bsk the user it they oant to continue to play. Keep the program runting until the user chooses to quit 6. In displaying the output correctly formatted, Remember to use the NOTE: You can expand the program to Rock, Paper, Scissors, Lizard, Spock if yor choose, https:ww.youtube. comewatch?-SLeEKT7-s setprecsion), ficed and setw) to correctly format numbered output if

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions

Question

3. List the three categories used by the Bureau of?

Answered: 1 week ago

Question

Evaluate three pros and three cons of e-prescribing

Answered: 1 week ago