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
Image of page 8
} 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 = "
Image of page 9
<(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];
Image of page 10
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]
Image of page 11
char die2=rand()%sides+1;//[1,number of sides] char sum1=die1+die2; return sum1; }
Image of page 12

You've reached the end of your free preview.

Want to read all 12 pages?

  • Fall '19
  • Dice, char rollDie

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors