Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Game: scissor, rock, paper) Write a function that plays the popular scissor-rock-paper game. (A scissor can cut a paper, a rock can knock a

C++
image text in transcribed
image text in transcribed
Game: scissor, rock, paper) Write a function that plays the popular scissor-rock-paper game. (A scissor can cut a paper, a rock can knock a scissor, and a paper can wrap a rock.) void gameOfScissorRockPaper(int) The function randomly generates a number 0, 1, or 2 representing scissor, rock, and paper. It prompts the user to enter a number 0, 1, or 2 and displays messages indicating the choices from the user and computer, whether the user or the computer wins, loses, or draws The function takes one intargument specified how many first wins from the computer or the user to win the game. It will let the user continuously play until either the user or the computer wins. Please specify how many wins to get the result: 2 Please enter your choice - scissor (e), rock (1), paper (2): 4 Invalid input! Please enter only , 1 or 2. Please enter your choice - scissor (0), rock (1), paper (2): 0 Computer's choice is paper (2) Your choice is scissor (e). You won Please enter your choice - scissor (0), rock (1), paper (2): 0 Computer's choice is rock (1) Your choice is scissor (e). You lost Please enter your choice - scissor (8), rock (1), paper (2): 0 Computer's choice is scissor (e). Your choice is scissor (e). It is a draw Please enter your choice - scissor (8), rock (1), paper (2): Computer's choice is scissor (e). Your choice is scissor (e). It is a draw Please enter your choice - scissor (8), rock (1), paper (2): 0 Computer's choice is paper (2) Your choice is scissor (e). You won Congratulations! You got the first 2 wins. Program ended with exit code: Please specify how many wins to get the result: 1 Please enter your choice - scissor (0), rock (1), paper (2): 2 Computer's choice is scissor (0). Your choice is paper (2) You lost Sorry, you lost. The computer got the first 1 win(s). Program ended with exit code

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 Management Systems Designing And Building Business Applications

Authors: Gerald V. Post

1st Edition

0072898933, 978-0072898934

More Books

Students also viewed these Databases questions