Question: Hello, I need some help with this program of c++ here is the link https://sites.google.com/site/uiccs141/programs/prog-1-dice I am done till the step 3 of this program

Hello, I need some help with this program of c++ here is the link

https://sites.google.com/site/uiccs141/programs/prog-1-dice I am done till the step 3 of this program and need help with step 4 to do a loop to produce the output 50 times.

Here is my program that produces the output one time.

#include

#include // Needed for rand() to work

using namespace std;

int main()

{

cout << "Class: CS 141" << endl;

cout << "System: C++ in codio.com" << endl;

cout << "Welcome to the dice game, where you and your opponent each choose" <

cout << "one of the red, green or blue dice and roll them." <

cout << "The dice contain the following sides:" << endl;

cout << " Red: 1 4 4 4 4 4" << endl;

cout << " Green: 2 2 2 5 5 5" << endl;

cout << " Blue: 6 3 3 3 3 3" << endl;

int red[] = {1,4,4,4,4,4};

int green[] = {2,2,2,5,5,5};

int blue[] = {6,3,3,3,3,3};

int player1Score=0,player2Score=0;

char player1Color,player2Color;

cout<<"Enter the die colors (R G or B): " << endl;

cin>>player1Color>>player2Color;

int player1Value=0,player2Value=0;

int randomNumber1,randomNumber2;

randomNumber1=(rand()%6);

randomNumber2=(rand()%6);

if(player1Color=='R')

player1Value=red[randomNumber1];

else if(player1Color=='G')

player1Value=green[randomNumber1];

else if(player1Color=='B')

player1Value=blue[randomNumber1];

if(player2Color=='R')

player2Value=red[randomNumber2];

else if(player2Color=='G')

player2Value=green[randomNumber2];

else if(player2Color=='B')

player2Value=blue[randomNumber2];

if(player1Value>player2Value)

player1Score++;

else if(player1Value==player2Value){

}

else{

player2Score++;

}

cout<

cout<<" Score: "<

return 0;

}//end main()

I need help with the 4th step to do a loop and run the dice 50 times.

I would really appreciate if you could help me with the last step, Thank you.

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!