C++ flowchart | Computer Science homework help

Want answers to the assignment Below?

Text or Whatsapp Olivia at +1 (307) 209-4351


 

Place your order today at a 20% discount

 
Flow chart the Craps please make the flowchart
can i get pdf file or anything i can open on the computer and edit if i want to 
code
//System Libraries#include <iostream> //Input – Output Library#include <ctime> //Time for rand#include <cstdlib> //Srand to set the seed#include <fstream> //File I/O#include <iomanip> //Format the output#include <string> //Strings#include <cmath> //Math functionsusing namespace std; //Name-space under which system libraries exist
//User Libraries
//Global Constantsconst float PERCENT=100.0f;//Conversion to Percent
//Function Prototypeschar rollDie(int); //Roll the Dicevoid fileDsp(ofstream &,int [],int [],int,int,int,int); //File Displayvoid scrnDsp(int [],int [],int,int,int,int); //Screen Displayvoid crpGame(int [],int [],int,int &,int &,int &); //Play Craps
//Execution begins hereint main(int argc, char** argv) {//Set the random number seedsrand(static_cast<unsigned int>(time(0))); 
//Declare file and game variablesifstream in; //Input Fileofstream out; //Output Fileint nGames; //Number of games, wins/lossesint mxThrw=0,numThrw=0,lmGames=100000000;//Game limiter and Throw statisticsconst int SIZE=13; //Size of our Arraysint wins[SIZE]={}; //Initializing the win arrayint losses[SIZE]={}; //Initializing the loss array 
//Initialize variablesstring inName=”GameInfo.dat”; //String Namechar outName[]=”GameStats.dat”; //Character Array Namein.open(inName.c_str()); //Open the Input fileout.open(outName); //Open the Output filewhile(in>>nGames);//Last value in file becomes the number of gamesnGames=nGames>lmGames?lmGames:nGames;//Limit games if to high 
//Play the game the prescribed number of times.int beg=time(0);//Time the game playcrpGame(wins,losses,SIZE,nGames,numThrw,mxThrw);int end=time(0);//End time of Game play 
//Output the game statistics to the screenout<<“Total time to play these Games in integer seconds = “<<end-beg<<endl;scrnDsp(wins,losses,SIZE,nGames,numThrw,mxThrw); 
//Output the game statistics to the screencout<<“Total time to play these Games in integer seconds = “<<end-beg<<endl;fileDsp(out,wins,losses,SIZE,nGames,numThrw,mxThrw); 
//Close filesin.close();out.close(); 
//Exit stage rightreturn 0;}
void crpGame(int wins[],int losses[],int SIZE,int &nGames,int &numThrw,int &mxThrw){for(int game=1;game<=nGames;game++){//Throw dice and sum, keep track of number of throws in a gameint gmThrw=1;char sum1=rollDie(6);//Determine wins and lossesswitch(sum1){case 7:case 11:wins[sum1]++;break;case 2:case 3:case 12:losses[sum1]++;break;default:{//Loop until a 7 or previous sum is thrownbool thrwAgn=true;do{//Throw the dice againchar sum2=rollDie(6);gmThrw++;//Increment the number of throwsif(sum2==7){losses[sum1]++;thrwAgn=false;}else if(sum1==sum2){wins[sum1]++;thrwAgn=false;}//end of dependent if-else}while(thrwAgn);//end of do-while}}//end of switch//Keep track of total throws and max throwsnumThrw+=gmThrw;if(mxThrw<gmThrw)mxThrw=gmThrw;//Independent if}//end of for-loop}
void fileDsp(ofstream &out,int wins[],int losses[],int SIZE,int nGames,int numThrw,int mxThrw){out<<fixed<<setprecision(2)<<showpoint;out<<“Total number of Games = “<<nGames<<endl;out<<“Roll Wins Losses”<<endl;int sWins=0,sLosses=0;for(int sum=2;sum<SIZE;sum++){sWins+=wins[sum];sLosses+=losses[sum];out<<setw(4)<<sum<<setw(10)<<wins[sum]<<setw(10)<<losses[sum]<<endl;}out<<“Total wins and losses = “<<sWins+sLosses<<endl;out<<“Percentage wins = “<<static_cast<float>(sWins)/nGames*PERCENT<<“%”<<endl;out<<“Percentage losses = “<<static_cast<float>(sLosses)/nGames*PERCENT<<“%”<<endl;out<<“Maximum number of throws in a game = “<<mxThrw<<endl;out<<“Average throw per game=”<<static_cast<float>(numThrw)/nGames<<endl;out<<“Ratio of Longest to shortest game = 10^”<<log10(mxThrw)<<endl;
}
void scrnDsp(int wins[],int losses[],int SIZE,int nGames,int numThrw,int mxThrw){cout<<fixed<<setprecision(2)<<showpoint;cout<<“Total number of Games = “<<nGames<<endl;cout<<“Roll Wins Losses”<<endl;int sWins=0,sLosses=0;for(int sum=2;sum<SIZE;sum++){sWins+=wins[sum];sLosses+=losses[sum];cout<<setw(4)<<sum<<setw(10)<<wins[sum]<<setw(10)<<losses[sum]<<endl;}cout<<“Total wins and losses = “<<sWins+sLosses<<endl;cout<<“Percentage wins = “<<static_cast<float>(sWins)/nGames*PERCENT<<“%”<<endl;cout<<“Percentage losses = “<<static_cast<float>(sLosses)/nGames*PERCENT<<“%”<<endl;cout<<“Maximum number of throws in a game = “<<mxThrw<<endl;cout<<“Average throw per game=”<<static_cast<float>(numThrw)/nGames<<endl;cout<<“Ratio of Longest to shortest game = 10^”<<log10(mxThrw)<<endl;
}
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;}

Don't use plagiarized sources. Get Your Custom Essay on
C++ flowchart | Computer Science homework help
From Just $13/Page
Order Essay

ORDER ASSIGNMENT

About ASAP Essays

We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.

How It Works

To make an Order you only need to click on “Order Now” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Are there Discounts?

All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.

Hire a tutor today CLICK HERE to make your first order

CLICK HERE  To order your paper

About ASAP ESSAYS writing service

We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.

How It Works

To make an Order you only need to click on “Order Now” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Are there Discounts?

All new clients are eligible for upto 20% off in their first Order. Our payment method is safe and secure.

CLICK HERE  To order your paper

Order your Assignment today and save 15% with the discount code ESSAYHELP

X