| stasiakiewicz (3) | |
|
Write a C++ program that simulates the casino game of craps. These are the rules of the game: • If a player throws a 7 or 11 (sum of two dice) on the first roll, the player wins the game. • If a player throws a 2, 3 or 12 (sum of two dice) on the first roll, the player loses the game. • If a player throws a 4, 5, 6, 8, 9 or 10 (sum of two dice) on the first roll, s(he) neither wins nor loses but creates a “point.” If this is the case, the player keeps rolling the dice until the point (4, 5, 6, 8, 9 or 10) is thrown again, and the player wins the game. However, if the player throws a 7 (sum of two dice) before the “point” is thrown, the player loses the game. These are the specifications for the program: Your program will incorporate a void function that will output a banner to the screen each time the a.out is invoked. The banner will look like ********************************************************** ********* Welcome to the [Your Name] Casino ********* ********* Step up to the table and place your bets! ****** ********************************************************** You will create a function called rollDice that will, when called, roll two dice and return a random number between 2 and 12. Each time rollDice is called, the program should output the result of the roll. Examples: You rolled 8 You rolled 5 You rolled 4 or You rolled 4 You rolled 3 You rolled 7. You lose! You rolled 8. Winner! … and so on. The program will ask the player ” Another game? Y(es) or N(o)?” and terminate whenever any key other than Y or y is pressed. Hint: use program example 6-4 as a model for your rollDice function. can someone please help me write this program | |
|
|
|
| Computergeek01 (2873) | |
| This is literally "srand()", "rand()" and a switch case block. If you're having trouble it's because you're either over thinking it or you're burning out. Take a break, come back to it and post what you come up with. We'll gladly help you from there. | |
|
|
|