Question
C++ programming language, starting out with C++. Looping Constructs Write a program to simulate the casino game craps. It should execute N number of games
C++ programming language, starting out with C++.
Looping Constructs
Write a program to simulate the casino game "craps". It should execute N number of games so that you can compute the probability(%) of the "player" winning and the "house" winning.
Probability(%) of the "player" winning = PlayerWins / N * 100.
Probability(%) of the "house" winning = HouseWins / N * 100.
The rules are:
Player rolls two dice. When the sum is 7 or 11 on first throw, player wins. Game over. When the sum is 2, 3, or 12 on first throw, "house" wins. Game over.
When the sum is 4,5,6,8,9, or 10 on first throw, that sum becomes the player's "point". Now, to win the player must continue rolling the dice until he matches "point"; however should he roll a 7 then the "house" wins. That concludes the game.
Run six(6) Simulations to complete the Table:
Number of Games %Prob(PlayerWins) %Prob(HouseWins) --------------------------------------------------------- 1,000 10,000 100,000 1,000,000 10,000,000 100,000,000
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started