Question: in c + + Step 0 . Read starter template and do not change the provided code. Integer constants are defined for ROCK, PAPER, and

in c++
Step 0. Read starter template and do not change the provided code. Integer constants are defined for ROCK, PAPER, and SCISSORS. A Random object is created and a seed is read from input and passed to the Random object. This supports automated testing and creates predictable results that would otherwise be random.
Step 1(2 pts). Read two player names from input . Read number of rounds from input. Continue reading number of rounds if value is below one and provide an error message. Output player names and number of rounds. Submit for grading to confirm 2 tests pass.
Ex: If input is:
3 Anna Bert -3-44
Sample output is:
Rounds must be >0 Rounds must be >0 Anna vs Bert for 4 rounds
Step 2(2 pts). Generate random values (0-2) for player 1 followed by player 2 by calling rand()%3. Continue to generate random values for both players until both values do not match. Output "Tie" when the values match. Submit for grading to confirm a total of 3 tests pass.
Ex: If input is:
10 Anna Bert 1
Sample output is:
Anna vs Bert for 1 rounds Tie Tie
Step 3(3 pts). Identify winner for this round and output a message. Rock crushes scissors, scissors cut paper, and paper covers rock. Submit for grading to confirm a total of 6 tests pass.
Ex: If input is:
39 Anna Bert 1
Sample output is:
Anna vs Bert for 1 rounds Tie Tie Bert wins with scissors
Step 4(3 pts). Add a loop to repeat steps 2 and 3 for the number of rounds. Output total wins for each player after all rounds are complete. Submit for grading to confirm all tests pass.
Ex: If input is:
82 Anna Bert 3
Sample output is:
Anna vs Bert for 3 rounds Anna wins with paper Tie Anna wins with rock Anna wins with paper Anna wins 3 and Bert wins 0

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 Programming Questions!