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

A popular game of chance is called “craps,” which is played in casinos and back

ID: 3623847 • Letter: A

Question

A popular game of chance is called “craps,” which is played in casinos and back alleys. The rules of the game are the following:

A player rolls two dice. Each die has six faces. These faces contain 1, 2, 3, 4, 5 and 6 spots. After the dice have come to rest, the sum of the spots on the two upward faces is calculated. 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 (called “craps”), the player loses. If the sum is 4, 5, 6, 8, 9 or 10 on the first roll, then that sum becomes the player's “point.” To win, the player must continue rolling the dice until he/she “makes point.” The player loses by rolling a 7 before the point. Package, as a function, the portion of the program that runs one game of craps. Create a variable that keeps track of the player's balance, initially this value should be $1,000. Prompt the player to enter a wager. Check to make sure that the player has enough money to cover the wager. Call the craps game function and if the player wins, increase the balance by the amount of the wager. If the player looses, decrease the balance by the amount of the wager. If the balance becomes zero, print the message “Sorry, you are busted!” and end the game.Have the game create some chatter, such as “Oh, you are going broke!” or “Take a chance” or
“You are up big. Now is the time to cash in your chips!” or whatever else you would like.
Comments must be relative to the players balance. Your code should be modular, well constructed and make extensive use of functions. All user input should be tested for validity. Be sure to print out the the values of each dice, the status of the roll (i.e. win, lose, roll-again). At the end of each game the user should see a balance of the money in their account. Make proper use of constants and ask the user if they would like to continue to play or cash in their chips. Try to make the game as fun and entertaining as possible.

Explanation / Answer

#include using std::cout; using std::cin; using std::endl; // contains prototypes for functions rand & srand # include using std::rand; using std::srand; // contains prototype for function time # include using std::time; int rollDice(); bool craps(); int main() { int bankBalance = 100; int wager; while (bankBalance > 0) { while (true) { cout > wager; if (bankBalance
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote