Question
A player rolls two six-sided die. After the dice come to rest they are added together and their sum provides the outcome. If the sum
A player rolls two six-sided die. After the dice come to rest they are added together and their sum provides the outcome. If the sum is 7 or 11 on the first roll, the player wins. If the sum is 2, 3, or 12 on the first roll, the player loses (this is a game called craps). If the player rolls 4, 5, 6, 8, 9, or 10 on the first throw, then that becomes the players point. To win, the player must make their point, which means they must roll the sum they got on that first throw, so they keep rolling the dice. The player loses by rolling a 7 before making the point. A game ends when a player either makes their point or loses and the number of total rolls is never prior determined.
Write a C++ program of the game
We must include these requirements:
The user must enter a random number seed or use the time function in srand(), and how many games they would like to play-- there must be a minimum of five rolls (meaning five full games not rolls as a player may roll multiple times in one game).
A function that generates the roll of the dice. Two separate random numbers must be used within the function. The function will require call by reference as it is necessary to return the sum of the two die as well as the value of each die in order to print.
A function that prints out an intro (our own words) and returns the number of games the user wants to play to main.
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