Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include #include #include #include using namespace std; void drawHeading(string title); void drawDieFace(int face); //int rollDie(); //void drawDiceFace(int face1, int face2); /**************************************************************************** Function: main Description:

image text in transcribed

image text in transcribed

#include

#include

#include

#include

#include

using namespace std;

void drawHeading(string title);

void drawDieFace(int face);

//int rollDie();

//void drawDiceFace(int face1, int face2);

/****************************************************************************

Function: main

Description: Performs some calculations on points

Parameters: None

Returned: Exit Status

****************************************************************************/

int main() {

int face;

int roll;

drawHeading(" Craps ");

drawDieFace();

roll= rollDie();

srand(static_cast (time(static_cast(NULL))));

int random = rand() % 6 + 1;

//drawDiceFace(int face1, int face2);

system("pause");

return EXIT_SUCCESS;

}

/******************************************************************************

Function: printTitle

Description: Displays a title to the screen in the form:

**************************

* title *

**************************

Parameters: title - the title to be displayed to the screen

Returned: None

******************************************************************************/

void drawHeading(string title) {

cout

cout

cout

cout

}

/******************************************************************************

Function: drawDieFace

Description: Displays a die face to the screen in the form:

" ----- "

"| |"

"| |"

"| |"

" ----- "

Parameters: face - the dice to be displayed to the screen

Returned: None

******************************************************************************/

void drawDieFace(int face) {

if (face == 1) {

cout

cout

cout

cout

cout

}

if (face == 2) {

cout

cout

cout

cout

cout

}

if (face == 3) {

cout

cout

cout

cout

cout

}

if (face == 4) {

cout

cout

cout

cout

cout

}

if (face == 5) {

cout

cout

cout

cout

cout

}

if (face == 6) {

cout

cout

cout

cout

cout

}

}

/******************************************************************************

Function: rollDie

Description: Displays a title to the screen in the form:

Returned: None

******************************************************************************/

int rollDie() {

int random = rand() % 6 + 1;

while (random

}

return rollDie;

}

/******************************************************************************

Function: drawDiceFace

Description:

Parameters: face1

face2

Returned: None

******************************************************************************/

void drawDiceFace(int face1, int face2) {

}

For this assignment, you will write a program that plays craps. If you aren't familiar with the game, here are the basics. Craps is played by rolling a pair of dice and using the sum of the pair as the roll's value. If one die shows 4 and the other shows 5, you have rolled a 9. On the first roll, if the value is 7 or 11, you've rolled a natural and win. If you roll a 2, 3, or 12 on the first rol, you crap out or lose. If you roll anything else, you establisha point. The object is to keep rolling until you roll the point again. However, if you roll a 7 before your point, you lose. If you reach the point without first rolling a 7, you win. The program will end once you win or lose. BASIC CRAPS PLAY (on a pass line be START HERE ROLL AGAIN ishooting for The Point"now) COME OUT ROLL (1st soll of the Round ls the total 7 or 117 Did you roll The Point START OVER START OR is the total 2,3 or 127 Did you ro a Seven? START OVER TART OVER ROLL AGAIN TRY FOR THE POINT So you must have rolled a 4,5,6,8,9 or 10 so that number is now THE POINT http://casinorank.com/rules-of-craps/ Since you need to randomly roll the dice, you will need a pseudo random number generator. The random include the following line of code once at the beginning of your main fu number generator is seeded using the current time. You must nction: time(static_cast

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

Advances In Databases And Information Systems Uropean Conference Adbis 2020 Lyon France August 25 27 2020 Proceedings Lncs 12245

Authors: Jerome Darmont ,Boris Novikov ,Robert Wrembel

1st Edition

3030548317, 978-3030548315

More Books

Students also viewed these Databases questions

Question

What is an interface? What keyword is used to define one?

Answered: 1 week ago