Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In the game of Lucky Sevens, the player rolls a pair of dice. If the face values of the dice add up to 7, the
In the game of Lucky Sevens, the player rolls a pair of dice. If the face values of the dice add up to 7, the player wins $4; otherwise, the player loses $1. Write a C++ program that takes as input the amount of money the player has. The program should play the game until the player has no money. The program should print the number of rolls it took to break the player. Use the random number generator to simulate the rolling of two dice. Keep track of maximum amount of money the player ever had and the number of rolls it took to reach it See below for a sample input/output The user should have the option to play again if he/she chooses. Sample input/output: Enter the amount of money you have: 100 It took 420 rolls to loose all your money. Your maximum was $103.00 and was reached after 6 rolls. Play again (y)?y Enter the amount of money you have: 20 It took 30 rolls to loose all your money. Your maximum was $24.00 and was reached after 1 rolls. Play again (y)?y Enter the amount of money you have: 50 It took 270 rolls to loose all your money. Your maximum was $66.00 and was reached after 123 rolls. Play again (y)?n
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started