Question: Write a complete C++ program that implements a game of Rock, Paper, Scissors between a user and the computer. Print out a prompt and have

Write a complete C++ program that implements a game of Rock, Paper, Scissors between a user and the computer.

Print out a prompt and have the program give the player the following menu:

1. Rock

2. Paper

3. Scissors

After reading in a number from the keyboard, use a selection structure to set the players choice to one of the strings Rock, Paper, or Scissors. Use the C++ rand method to generate a random number in the range 1-3 for the computers turn, then use another decision structure to set the computers choice to one of the three strings. Make sure to seed the random number generator appropriately. Finally, using some combination of decision structures,

decide the winner of the game using the following rules:

Rock crushes scissors (Rock wins)

Scissors cut paper (Scissors wins)

Paper covers rock (Paper wins)

Inform the user of the player choices, the rule used, and tell the user who won (the user or the computer).

Make sure you write a complete C++ program. You may use additional variables as necessary. Add judicious comments to document your code.

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!