Question: c++ rock paper scissors game Algorithm: programme - Generate three random numbers (0, 1, or 2) - Save the three numbers in an array called:

c++

rock paper scissors game

Algorithm: programme

- Generate three random numbers (0, 1, or 2)

- Save the three numbers in an array called: int compplay[3]

-- Or ... if number is 0, save an 'R' in: char compplay[3]

-- ...... if number is 1, save a 'P,

-- ...... if number is 2, save a 'S'

-- Or ... you can use enumerated types

-Set a flag to 1 (later, if user wants to quit, set it to 0)

-Have a for loop that loops 3 times (0-2) unless user wants to quit

-- Have user1 enter R for rock, P for paper, or S for scissors

-- If the user entered an R and complay[0] is an R, then you have a tie

-- else if the user entered an R and complay[0] is a P then user loses

-- else if the user entered an R and complay[0] is an S then user wins

--- Ask user if they want to keep playing. If it's an n or N, then

use break to get out of loop

The loop should now repeat and you do this again comparing to complay[1], etc...

-Thank user for playing when they are done with their three attempts.

HERE are the rules which determines who wins:

Rock beats scissors

Paper beats rock

Scissors beats paper

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!