/* * THE APPROACH TO EQUILIBRIUM */ #include"lib351.h" void main(){ // output initialization ofstream dataOutStr; outFileMaker("m357p1c.out", &dataOutStr); // program variable definitions int nCoins, nFlips, nStep, nRanCoin, nFlip, nDot, nRun, nTails, nStatus; double dblRanNum, dblNormedRanNum, dFracTails; const double m_pi = 3.141592654; const double dblSeed = 13.; const double dblConst = 899.; const double dblMod = 32768.; const double dblMaxNum = dblMod - 1.; const int nDots = 71; const int nLines = 50; char cLine[72]; int nStatuses[1001]; // initialize the random number generator dblRanNum = dblSeed; // cycle through the runs nRun = 0; bool goout = false; while (!goout){ nRun++; // data input cout <<"Number of Coins ="<< endl; cin >> nCoins; cout <<"\nNumber of Flips ="<< endl; cin >> nFlips; // set the step in number of turns from one line to the next nStep = int(nFlips/nLines); if(nStep == 0){nStep = 1;} // initialize the status of each coin to 'up' for (int nCoin = 1; nCoin <= nCoins; nCoin++){ nStatuses[nCoin] = 1; } dFracTails = 0; // output the header for this run dataOutStr<<"\f"<