Question: Write a C++ program that lets the user play the game of Rock, Paper, Scissors against the computer. Divide the program into functions

Write a C++ program that lets the user play the game of "Rock, Paper, Scissors" against the computer. Divide the program into functions that perform each major task. The program MUST include the following:

1. DoWhile Loop

2. Menu function

3. Minimum of three task functions (Example: "rock", "paper", "scissors")

4. DO NOT use "global" variables

The program will perform as follows (check out the logic flowchart on the page three):

1. When the program begins, a random number in the range of 1 through 3 is generated. If the number is a 1, then the computer has chosen "rock". If the number is 2, the computer has chosen "paper". If the number is 3, the computer has chosen "scissors". (But dont display the computers choice yet).

2. The user then enters his/her choice of "rock", "paper", or "scissors" at the keyboard (this is the logical place to use a menu ).

3. The computers choice is then displayed on the console.

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. (Rock smashes scissors).

b. If one player chooses scissors and the other player chooses paper, then scissors wins. (Scissors cut 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, it is a tie, and the game must be played again to determine a winner.

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!