Question
(I need this in Dev-C++ ) For this portion of Lab #4, you will be combining the control statements and selection statements we have been
(I need this in Dev-C++ )
For this portion of Lab #4, you will be combining the control statements and selection statements we have been discussing to write a simple dice game. In this game, the player bets a certain quantity of money, and then wins or loses depending on the throw of the dice as follows:
Dice Throw: | Original amount of money is: |
6 or 12 | Tripled |
8 or 9 | Doubled |
7 or 11 | Lost |
all others | no change |
HINT: Remember the random number generator function that we explored in our number-guessing game. This game involves rolling a pair of six-sided dice, so you will need to generate two random numbers, each in the range 1 to 6, to represent the face values of each die. The sum of these two values is the value of the throw. With each turn, the program should prompt the player for the bet and then print the results, and it should also ask the player at the end of each turn if he or she wishes to play again.
Here is an example of what a completed game should look like:
GET READY TO PLAY THE DICE GAME! WHAT IS YOUR BET? 10 DICE THROW IS 5 NO CHANGE YOUR TOTAL WINNINGS ARE: $0.00 PLAY AGAIN? Y WHAT IS YOUR BET? 25 DICE THROW IS 7 YOU LOST! YOUR TOTAL WINNINGS ARE: -$25.00 PLAY AGAIN? Y WHAT IS YOUR BET? 25 DICE THROW IS 7 YOU LOST! YOUR TOTAL WINNINGS ARE: -$50.00 PLAY AGAIN? Y WHAT IS YOUR BET? 50 DICE THROW IS 8 YOU WIN! YOU DOUBLED YOUR BET! YOUR TOTAL WINNINGS ARE: $50.00 PLAY AGAIN? Y WHAT IS YOUR BET? 10 DICE THROW IS 5 NO CHANGE YOUR TOTAL WINNINGS ARE: $50.00 PLAY AGAIN? 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