Home / Expert Answers / Computer Science / in-c-part-a-nbsp-your-task-is-to-write-a-program-that-simulates-a-nbsp-game-of-craps-nbsp-nbsp-pa985

(Solved): In C++: Part A: Your task is to write a program that simulates a game of craps   ...



In C++:

Part A: Your task is to write a program that simulates a game of craps   with no human input using the following rules: Two six-sided dice are rolled; the first roll of the dice in a craps round is called the "come out roll'." A come out roll of 7 or 11 automatically wins, and a come out roll of 2, 3, or 12 automatically loses. If 4,5,6,8,9,or 10 is rolled on the come out roll, that number becomes "the point." The player then keeps rolling the dice ( use a do - while loop ) until either 7 or the point is rolled. If the point is rolled first, then the player wins the bet. If a 7 is rolled first, then the player loses. Test your program thoroughly printing the initial values of the 2 dice (also print point values as applicable) and win/lose messages. You will use the   C++ random number generator   to simulate the rolling of two dice and then calculate the sum ( see Resources -  Ch5_FlagControlledWhileLoop.cpp (includes random # and nested if-else).

Part B: Once you know your program is working properly, add a loop so that the program plays 10,000 games (You will want to remove all the cout statements at this time). Add counters that count how many times the player wins, and how many times the player loses. At the end of the 10,000 games, compute the probability of winning, i.e.wins / (wins + losses).Over the long run, who is going to win the most games, you or the house?



We have an Answer from Expert

View Expert Answer

Expert Answer


C++ Program: Part A: #include #include using namespace std; //Function prototypes //Function that plays the game bool TimeToPlay(
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe