Question: Using basic c++: 4. RockScissorsPaper Problem (Switch ) Write a program that plays the popular rock-scissor-papergame. A scissor can cut a paper, a rock can
Using basic c++:
4. RockScissorsPaper Problem (Switch ) Write a program that plays the popular rock-scissor-papergame. A scissor can cut a paper, a rock can knock a scissor and a paper can wrap a rock. Use a random generator and generate one number for 0,1,2 representing scissor , rock , paper. Input from user a value as scissor (0), rock (1), paper (2). Determine if User or computer wins. How to proceed? Switch on Computer Value(0,1,2) for each case say eg comp value is 0 (scissors) check on users value using if-else If both are equal its a draw. If you get a paper you lose If you get a rock computer wins Check for other 2 cases
Sample outputs is shown here
scissor (0), rock (1), paper (2): 0
The computer is rock. You are scissor. You lost
scissor (0), rock (1), paper (2): 2
The computer is paper. You are paper too. It is a draw
scissor (0), rock (1), paper (2): 1
The computer is scissor. You are rock. You won
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
