Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are required to write a C++ coin flip guessing game to entertain 3 children. The nature of the game is simple, each player starts

image text in transcribed

You are required to write a C++ coin flip guessing game to entertain 3 children. The nature of the game is simple, each player starts the game with 10 candies and is allowed to play 3 rounds coin flip guessing game. Before the start of each guess, the player needs to decide how many candies to be offered. The number of candies offered will be doubled if the player guessed the correct side of the coin. If the player makes a wrong guess, the candies offered will be forfeited. The current player's turn will end if he/she runs out of candies or after finishing 3 rounds. When all players finish their turn, the program will announce the winner based on who has the most candies. The children are known to throw a huge tantrum if the game is buggy, so please ensure that the program you write can deal with every possible outcome (draw or no winners) and is able to deal with any wrong or illogical input. A sample flow of the program is shown in Fig 1, you are free to use your own kid-friendly prompt and statements to make your game more aesthetically pleasing and fun. (Some kind of welcoming message, you can be creative with this) Greet player 1, ask for name: Levi Ackerman Hello Levi Ackerman, you have 10 candies and 3 guesses. Round 1, how many candies do you plan to offer: 5 Guess head or tails: head Flip...it's head! Yeah, you are right. Hello Levi Ackerman, you have 15 candies and 2 guesses. Round 2, how many candies do you plan to offer: 15 Guess head or tails: head Flip... it's tails! Opps, you are wrong. Hello Levi Ackerman, you have 0 candies left, your turn is over. Greet player 2, ask for name: Erwin Smith Hello Erwin Smith, you have 10 candies and 3 guesses. (...After 3 turns...) Hello Erwin Smith, you have 25 candies left, your turn is over. (...After player 3) Thank you everyone for playing, the winner is Player 3, Eren Yeager with a total of 100 candies

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems On GPUs In Databases

Authors: Johns Paul ,Shengliang Lu ,Bingsheng He

1st Edition

1680838482, 978-1680838480

More Books

Students also viewed these Databases questions

Question

What events or transactions change equity?

Answered: 1 week ago

Question

Question 4 Show that (pi(pvq)] q is a tautology

Answered: 1 week ago

Question

e. What difficulties did they encounter?

Answered: 1 week ago