We want you to submit to R\'Sub with srand(time(theta)); as the seed. However, w
ID: 660956 • Letter: W
Question
We want you to submit to R'Sub with srand(time(theta)); as the seed. However, when you are testing your program, you will want to compare your program's output with the sample runs, so you will want to work with the exact same random values that are used in our solution. To do this you have to seed rand with 333: srand(333); A note to those not working within C9. The random numbers generator by different systems (Windows, Linux, OS X) may be different as the implementation for generating pseudo random numbers is not exactly the same, so if you are developing outside C9 and are not getting precisely the displayed example, try either running on C9 or submitting to R'Sub. When debugging your program using srand(333), the first 25 rolls of the die should be: 5443345236524155336443426 Input Requirements Enter a single positive integer indicating the number at which to hold. Enter a single positive integer indicating the number of turns to be simulated. o Larger numbers will tend to yield better estimations but take longer to execute, o We test with both small and large numbers, so testing may take some time. Output Requirements Prompt the user with: "What value should we hold at? " Prompt for number of simulations: "Hold-at-N turn simulations? " Output a blank line between the input prompt and table output. On the next line, print "Score" and "Estimated Probability" separated by a tab (' '). After the simulations, print a table line for each score outcome that occurred, in increasing order of score. For each score outcome, print the score, a tab, and the fraction of turn simulations that yielded that score rounded to six digits after the decimal place.Explanation / Answer
#include #include // Enables use of rand() #include // Enables use of time() #include #include using namespace std; // get random integer number from 1 to 6 int genRandInt () { int randomNum; randomNum = rand () % 6 + 1; return randomNum; } int singleTurn () { srand(333); int currentScore = 0; int currentRoll =0; int holdValue = 0; int turnSimulation = 0; int countZero = 0; // count number of zero int countHoldValue =0; double ProbZero = 0.0; // probabily of zero // probability of holdvalue to holvalue +5 double ProbHoldValue =0.0000000, Prob1 =0.0000000, Prob2=0.0000000; double Prob3 =0.0000000, Prob4 =0.0000000, Prob5 =0.0000000; // variable to count each number in 6 possible outcomes int count1 = 0, count2 = 0; int count3 = 0, count4 = 0, count5 = 0; //get the hold Value from user cout > holdValue; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.