To play, the gambler first places a wager, W. The gambler then picks any number from 1-6. Let n represent the gambler's number. Next, the gambler rolls three six-sided dice. If none of the rolls equals n then the gambler loses W. If one of the rolls equals n then the gambler wins wager W back (even money, 1-1). If two of the rolls equals n then the gambler wins twice the wager W (2-1). If all three of the rolls equals n then the gambler wins three times W (3-1).

Write a program that implements a C++ version of Chuck-a-luck. It should output appropriate messages so the player knows what has happened. The player should be prompted to input a wager, select a number, and to initiate rolling the dice. The gambler should start with $100. The gambler should be allowed to keep playing until he or she runs out of money (don't allow a wager that is more than the amount of money owned) or the gambler decides to quit playing. For the selected number that should be from 1-6, your program should only allow the gambler to choose a valid number. For example, if 7 or 0 is entered then the gambler should be prompted to enter the number again.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.