C++ flowchart | Computer Science homework help

 

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 functions
using namespace std; //Name-space under which system libraries exist

//User Libraries

//Global Constants
const float PERCENT=100.0f;//Conversion to Percent

//Function Prototypes
char rollDie(int); //Roll the Dice
void fileDsp(ofstream &,int [],int [],int,int,int,int); //File Display
void scrnDsp(int [],int [],int,int,int,int); //Screen Display
void crpGame(int [],int [],int,int &,int &,int &); //Play Craps

//Execution begins here
int main(int argc, char** argv) {
//Set the random number seed
srand(static_cast<unsigned int>(time(0)));
 

//Declare file and game variables
ifstream in; //Input File
ofstream out; //Output File
int nGames; //Number of games, wins/losses
int mxThrw=0,numThrw=0,lmGames=100000000;//Game limiter and Throw statistics
const int SIZE=13; //Size of our Arrays
int wins[SIZE]={}; //Initializing the win array
int losses[SIZE]={}; //Initializing the loss array
 

//Initialize variables
string inName=”GameInfo.dat”; //String Name
char outName[]=”GameStats.dat”; //Character Array Name
in.open(inName.c_str()); //Open the Input file
out.open(outName); //Open the Output file
while(in>>nGames);//Last value in file becomes the number of games
nGames=nGames>lmGames?lmGames:nGames;//Limit games if to high
 

//Play the game the prescribed number of times.
int beg=time(0);//Time the game play
crpGame(wins,losses,SIZE,nGames,numThrw,mxThrw);
int end=time(0);//End time of Game play
 

//Output the game statistics to the screen
out<<“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 screen
cout<<“Total time to play these Games in integer seconds = “<<end-beg<<endl;
fileDsp(out,wins,losses,SIZE,nGames,numThrw,mxThrw);
 

//Close files
in.close();
out.close();
 

//Exit stage right
return 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 game
int gmThrw=1;
char sum1=rollDie(6);
//Determine wins and losses
switch(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 thrown
bool thrwAgn=true;
do{
//Throw the dice again
char sum2=rollDie(6);
gmThrw++;//Increment the number of throws
if(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 throws
numThrw+=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;
}

Order a unique copy of this paper
(550 words)

Approximate price: $22

Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees


We value our customers, and so ensure that our papers are 100 percent original. Our Team of professionals does not miss the mark; they ensure that step by step each paper is written uniquely. We never duplicate or work as we compare papers rest assured. We deliver our work a day before time to ensure that you don’t miss your deadlines. It is not only doing the work but delivering it at the right time. We capture the consequences of late remittances. .

Money-back guarantee

We value customer satisfaction here at popularessaywriters.com and make sure that you get the best value for your Money. It happens that sometimes you can pay twice for your order or may want to cancel it, or you feel that it doesn’t meet your requirements; our money back guarantee will give you the opportunity to get back your money. We will also refund 100% of money paid double. In case your paper does not satisfy your requirements , we request that you notify us via writing within 2 days otherwise on the third day we will assume that you have been satisfied. Do all your correspondences through our email address popularessaywriters@gmail.com.

Read more

Zero-plagiarism guarantee

At popularessaywriters.com, our professional writers know the consequence plagiarism does for our clients. We have updated software’s such as article checker and copyscape to check for originality of the custom papers before submission of the final paper to the you. Our guarantee to the customer is that we will write 100% original papers for them that are quality, timely and of low cost. We have experienced professional and competent PhD writers who will write quality custom papers for you..

Read more

Free-revision policy

. At popularessaywriters.com, we are proud to provide top-quality Essay writing service to our esteemed customers. We are ready to take up that challenging academic assignment that is giving you sleepless nights and simplify it for you according to your desired requirements. We are willing to revise your paper if it does not meet your requirements. At popularessaywriters.com, we do not compromise with quality; thus, we offer unlimited free revisions until the customer is satisfied with their custom paper. Our unlimited free revision services are provided under the following terms:.. .

Read more

Privacy policy

Popularessawriters.com knows that client’s information is an essential tool for our company. It means that whatever the client requests from our service is kept strictly confidential. It means that whoever writes for this company understands the terms and conditions hence you should not be worried because you will never see your work somewhere else...

Read more

Fair-cooperation guarantee

Rest assured that we will always be attentive to your needs and requirements. We belief in the phrase treat your neighbour as you would want them to treat you. We leave nothing to chance and always look forward to a good interaction with each other.. .

Read more

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency