Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

ASSIGNMENT: Create a program to allow a user to play a modified “craps” games. T

ID: 3641067 • Letter: A

Question

ASSIGNMENT:

Create a program to allow a user to play a modified “craps” games. The rules will be as follows:

1) User starts with $50.00 as their total.
2) Ask the user for their bet (maximum bet is their current total).
3) Throw a pair of dice.
a) If the total value is 7 or 11, the user is an instant winner. The user has the amount bet added back into their total. Ask the user if they wish to play again and if so they start at step two above.
b) If the total value is 2, 3, or 12, the user is an instant loser. The user has the amount bet deducted from their total. Ask the user if they wish to play again and if so they start at step two above.
c) If the total is anything else, remember this total as the “point” and roll again.
i) If the new total is equal to the “point”, the user wins and the process is the same as winning in (a) above
ii) If the new total is a 7, the user loses. And the process is the same as losing in (b) above.
iii) If the new total is anything else the user must roll again and again try to match the “point” of the first roll.

Explanation / Answer

Here ya go, hope this helps! #include #include #include #include using namespace std; //Returns the value of two rolled dice int rollDice() { //Returns a value between 2 and 12 return (( rand() % 6) + 1 ) + (( rand() % 6) + 1 ); } void playAgain(bool& answer) { char ch = 'a'; while(toupper(ch) != 'Y' && toupper(ch) != 'N') { cout > ch; } if(toupper(ch) == 'Y') { answer = false; } if(toupper(ch) == 'N') { answer = true; } } int main() { srand((unsigned int)time(NULL)); //Seed the random number generator //The starting money and the bet float money = 50.00; float bet = 0.0; bool donePlaying = false; int roll1 = 0, roll2 = 0; //Start the game loop while(!donePlaying) { while(bet money) { cout