Question: Create a C++ dice rolling game, with 2 players rolling twice, The program must have a random number funtion to choose a random number between

Create a C++ dice rolling game, with 2 players rolling twice,

The program must have a random number funtion to choose a random number between 1 and 6.

And each number is associated with a value: 1 is 20, 2 is 30, 3 is 40, 4 is 50, 5 is 60, 6 is 70;

When the player one rolls the dice for the first roll, his result is stored in an array1, also when player two rolls the dice for the first roll, his result is stored in an array2,

Then a cout statement prints the results for the first round.

Again player 1 rolls the dice for the second round, and player 2 rolls the dice for the second round,

the result of player one second round is added to the array1, and the result of player 2 second round is added to array2,

The program now prints the sum of the results of player one and the sum of the results of player two,

At the end the program will have a function that checks which player has a higher score and will display the name of the winning player.

Sample output:

******************************************

Round 1:

Player 1 rolls a 2 with a value of 30

Player 2 rolls a 4 with a value of 50

After round 1, Player 1 score is 30, Player 2 score is 50.

Round 2:

Player 1 rolls a 6 with a value of 70

Player 2 rolls a 3 with a value of 40

After second roll, Player 1 total score is 100, and total score for Player 2 is 90

The winner is Player 1, since he has the highest score.

******************************************

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!