Question: For this assignment, you will be combining the control statements and selection statements we have been discussing to write a version of the classic carnival
For this assignment, you will be combining the control statements and selection statements we have been discussing to write a version of the classic carnival shell game that you can play with the computer. In this game, the computer hides a bean under one of three cups, selected at random, and it is up to the player to correctly guess which cup has the bean.
With each turn, your game should select the cup at random, using the random number generation function we explored in earlier labs. The game should then prompt the player for his or her guess, along with the amount of money the player wants to bet on their guess. If the player guesses incorrectly, they lose the money they bet; if the player guesses correctly, they win twice the money they bet. At the end of each turn, the game should print the player's winnings as currency, and it should also ask the player if he or she wishes to play again.
Here is an example of what a completed game should look like. (In this example, the player's input is shown in bold.) i need this in dev c++ pls
READY TO PLAY THE SHELL GAME? SEE IF YOU CAN GUESS WHICH CUP HAS THE BEAN! OKAY, PLACE YOUR BET: 25 WHICH CUP HAS THE BEAN? IS IT 1, 2, OR 3? 3 YOU GUESSED RIGHT! YOU WON $50.00! YOUR TOTAL WINNINGS ARE $50.00 WANT TO TRY AGAIN? Y OKAY, PLACE YOUR BET: 25 WHICH CUP HAS THE BEAN? IS IT 1, 2, OR 3? 2 YOU GUESSED RIGHT! YOU WON $50.00! YOUR TOTAL WINNINGS ARE $100.00 WANT TO TRY AGAIN? Y OKAY, PLACE YOUR BET: 25 WHICH CUP HAS THE BEAN? IS IT 1, 2, OR 3? 1 FOOLED YA! THE BEAN WAS IN CUP 2 SORRY, YOU LOST $25.00! YOUR TOTAL WINNINGS ARE $75.00 WANT TO TRY AGAIN? N
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
