Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm trying to make a game of Craps in C++. This is how the teacher wants the program to run. Player rolled: 6 + 4

I'm trying to make a game of Craps in C++. This is how the teacher wants the program to run.

Player rolled: 6 + 4 = 10 The point is 10 Player rolled: 3 + 3 = 6 Player rolled: 6 + 3 = 9 Player rolled: 3 + 1 = 4 Player rolled: 3 + 4 = 7 You seven'd out and lost!
Player rolled: 2 + 5 = 7 You won!
Player rolled: 3 + 1 = 4 The point is 4 Player rolled: 5 + 1 = 6 Player rolled: 4 + 4 = 8 Player rolled: 6 + 6 = 12 Player rolled: 4 + 4 = 8 Player rolled: 2 + 1 = 3 Player rolled: 5 + 1 = 6 Player rolled: 2 + 4 = 6 Player rolled: 3 + 5 = 8 Player rolled: 5 + 3 = 8 Player rolled: 2 + 1 = 3 Player rolled: 2 + 2 = 4 You rolled your point! You won!
Player rolled: 6 + 6 = 12 Craps! You lost!

This is what I got so far

#include #include #include #include using namespace std;

int main() { int die1; int die2; int rollingDice; int rollingDice2; const int SnakeEyes = 1 + 1; const int Boxcars = 6 + 6; const int Craps = 2 or 3 or 12;

srand(21);

die1 = rand() % 6 + 1; die2 = rand() % 6 + 1; rollingDice = die1 + die2; rollingDice2 = die1 + die2;

cout << "Player rolled: " << die1 << " + " << die2 << " = " << rollingDice << endl << endl;

if (rollingDice == 7 or rollingDice == 11) { cout << "You won!" << endl; }

else if (rollingDice == 2 or rollingDice == 3 or rollingDice == 12) { cout << "Craps! You lost!" << endl; }

else if ( rollingDice == 4 or rollingDice == 5 or rollingDice == 6 or rollingDice == 8 or rollingDice == 9 or rollingDice == 10)

{ cout << "The Point is " << rollingDice << endl << endl; }

while (rollingDice2 != rollingDice && rollingDice2 != 7);

if (rollingDice2 == rollingDice) { cout << "You rolled your point! You won!" << endl; }

else if (rollingDice2 != 7) { cout << "You seven'd out and lost!" << endl; } else if (rollingDice2 = )

}

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

Beyond Big Data Using Social MDM To Drive Deep Customer Insight

Authors: Martin Oberhofer, Eberhard Hechler

1st Edition

0133509796, 9780133509793

More Books

Students also viewed these Databases questions