You will need to simulate the rolling of a pair of six-sided dice (using the ran
ID: 3623468 • Letter: Y
Question
You will need to simulate the rolling of a pair of six-sided dice (usingthe rand() function). To make the program act differently every time
you run it, the use of srand is recommended.
The result of a roll is the sum of the two dice. The game consists of
rounds and before each round the player can place a bet. The round
starts with the player rolling the dice. If they roll a 2, 3 or 12, the player
loses their bet. If they roll a 7 or 11 they win. Otherwise, their roll
becomes the ”point.” They then continue rolling the dice until either
they roll the point again, in which case they win, or they roll a 7, in
which case they lose.
The game is initialized with the player having $100. In each round
the player can bet between 1 and 25 dollars, but not more than they
currently have. At the end of each round they should have the option
of playing again if they still have money to bet with. They can keep
playing as long as they have money. When they finally quit the game
they should be informed of how many rounds they played and the most
they won in any one round and the most they lost in any one round.
Your implementation should provide appropriate interaction with
the user. When a player’s roll is required the program should prompt
the user to hit the enter key and then display the result of the roll (as
a pair of numbers). The program should prompt the user for their bet,
validate the input, and keep track of the player’s money (displaying
the total at the end of each round).
Be sure to use appropriate loop constructs. You may not use break
or continue statements.
Explanation / Answer
#include #include #include #include using namespace std; #define MIN_BET 1 #define MAX_BET 25 #define INIT 100 #define NO_POINT -1 int maxwin,maxlose,round; void exit_msg(){ coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.