Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions

Question

Will we be able to keep up with company growth?

Answered: 1 week ago

Question

How would you describe your typical day at work?

Answered: 1 week ago

Question

2. Write two or three of your greatest weaknesses.

Answered: 1 week ago