Question: c++ program Program (5): Game of Craps In the game of Craps, a player places a bet and then throws a pair of dice. If

c++ program

c++ program Program (5): Game of Craps In the game of Craps,

Program (5): Game of Craps In the game of Craps, a player places a bet and then throws a pair of dice. If the roll is a 7 or 11, the player wins; if the roll is 2, 3 or 12, the player loses. If any other number appears, there is no gain or loss, and the player may roll again, perhaps several times, using the same bet. Design and implement a program to play the game of craps. Use a random number generator to simulate the roll of each of the pair of dice separately, i.e., two separate random numbers, each is from 1 to 6 (not a single random number from 1 to 12 representing the sum of the dice. Why?). Design a function to do this and return the sum of the pair of dice. Design another function to receive that sum and then decide whether it is a win, loss, or otherwise. A game starts with a budget. Your program should be interactive, asking the player how much to bet (the bet should not be more than the budget!). After a dice roll, if there is no win or loss, the dice is rolled again using the same bet. If a win/loss occurs, the budget is increased/ decreased by the amount of bet. In this case, ask the player if he/she wishes to play again; if so, obtain another bet, otherwise the game is over. The game is also over if the budget reduces to zero. When the game is over, display how much was won or lost. If the player wishes, a whole new game could be started with a new budget, otherwise the program terminates. The program should simulate the play for only one person

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!