# Whilethrwagnend of do while end of switch keep track

• No School
• AA 1
• 12

This preview shows page 8 - 12 out of 12 pages.

}while(thrwAgn);//end of do-while } }//end of switch //Keep track of total throws and max throws numThrw+=gmThrw; if(mxThrw }//end of for-loop
} void fileDsp(ofstream &out,int wins[],int losses[],int SIZE,int nGames,int numThrw,int mxThrw){ out< out<<"Total number of Games = "< out<<"Roll Wins Losses"< int sWins=0,sLosses=0; for(int sum=2;sum sWins+=wins[sum]; sLosses+=losses[sum]; out< } out<<"Total wins and losses = "< out<<"Percentage wins = "
<(sWins)/nGames*PERCENT<<"%"< out<<"Percentage losses = " <(sLosses)/nGames*PERCENT<<"%"< out<<"Maximum number of throws in a game = "< out<<"Average throw per game="<(numThrw)/nGames< out<<"Ratio of Longest to shortest game = 10^"< } void scrnDsp(int wins[],int losses[],int SIZE,int nGames,int numThrw,int mxThrw){ cout< cout<<"Total number of Games = "< cout<<"Roll Wins Losses"< int sWins=0,sLosses=0; for(int sum=2;sum sWins+=wins[sum];
sLosses+=losses[sum]; cout< } cout<<"Total wins and losses = "< cout<<"Percentage wins = " <(sWins)/nGames*PERCENT<<"%"< cout<<"Percentage losses = " <(sLosses)/nGames*PERCENT<<"%"< cout<<"Maximum number of throws in a game = "< cout<<"Average throw per game="<(numThrw)/nGames< cout<<"Ratio of Longest to shortest game = 10^"< } char rollDie(int sides){ char die1=rand()%sides+1;//[1,number of sides]
char die2=rand()%sides+1;//[1,number of sides] char sum1=die1+die2; return sum1; }

#### You've reached the end of your free preview.

Want to read all 12 pages?

• Fall '19
• Dice, char rollDie

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern