Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ post screenshots of program and output Write a program that simulates the game of craps, which is played with two dice. On the first
C++
Write a program that simulates the game of craps, which is played with two dice. On the first roll, the player wins if the sum of the dice is 7 or 11. The player loses if the sum is 2, 3, or 12. Any other roll is called the "point", and the game continues. On each subsequent roll, the player wins if he or she rolls the point again. The player loses by rolling a 7. Any other roll is ignored and the game continues. At the end of the each game, the program will ask the user whether or not to play again. When the user enters a response other than 'y' or 'Y', the program will display the total number of wins and losses and then terminate. Specifications: Write the program using three functions: main, rolldice, and playGame. Use the following function prototypes: int rolldice (void); bool playGame (void); rollDice () should generate two random numbers, each between 1 and 6, and return their sum. Use the rand() function to generate random numbers. playGame() should play one craps game (calling rollDice () as many times as necessary to determine the outcome of each dice roll); it will return true if the player wins and false if the player loses (t. play_game is also responsible for displaying messages showing the results of the player's dice rolls. main will call play_game repeatedly, keeping track of the number of wins and losses, and displaying the "You WIN!" and "You lose!" messages. At the beginning main, after displaying a "Welcome to Craps" message, you should prompt the user to enter a random seed (to satisfy the grader program). Finally, use the exit() function and the EXIT_SUCCESS constant to exit your program (which are both defined in post screenshots of program and output
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