Question: C++ programming Playing A Game for Relaxing Three Strikes and You Are Out Three Strikes is a popular game played for winning a car. There

C++ programming

Playing A Game for Relaxing

Three Strikes and You Are Out

Three Strikes is a popular game played for winning a car.

There are five chips, each with one of the digits of the price of the car, and three chips with Xs (strikes).

All the digits of the price are different and unique (only one of its kind).

The eight chips are placed in a bag. The contestant picks chips from the bag one by one.

If the contestant picks a digit, she/he must guess which position in the price of the car the digit belongs.

If she/he is right, the digit lights up on the board, and the digit is discarded from the bag. If not, the digit isplaced back in the bag.

If the contestant should pick a strike, the strike is removed from the bag.

The contestant wins if she/he fills out the price of the car before picking out all three strikes.

Write a C++ program to implement the game.

Requirements:

You cannot pick a digit that was not in the price of the car. It's impossible to do that. (5 points)

After each pick, the number of strikes hit and the number of digits correctly placed must be shown onscreen. (3 points)

After a digit was placed correctly, it cannot be picked again. (5 points)

And there must be a panel displayed to show the process of the game, locating the digits that wereanswered correctly. (3 points)

In the end, regardless of losing or winning the game, the price of the car must be displayed on the screen. (2 points)

Allow your program run continuously with another game until the user wants to end. (2 points)

Your name must be displayed at the end of the program. (2 points)

*********** Welcome to Three Strikes Game ***********

Pick a chip from a bag, the chip will contain

a digit or a strike, if it's a digit then guess

which position it belongs to the car's price

PANEL : _ _ _ _ _ <- this is the 0th position

POSITION: 4 3 2 1 0

Accumulating three strikes will result in losing the game.

~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~

The price must be hidden: $54307

(Shhhh! It's revealed to you as the programmer's darling!!!)

~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~

Enter 'p' to pick a chip, or any other key to quit the game: p

Strikes hit: 0

Digits placed: 0

Panel: $ _ _ _ _ _

4 3 2 1 0

~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~

You picked the digit: 4

Which position do you think it is? 3

Correct, you picked the correct position!!!

Enter 'p' to pick a chip, or any other key to quit the game: p

Strikes hit: 0

Digits placed: 1

Panel: $ _ 4 _ _ _

4 3 2 1 0

~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~

You picked a strike!!!

Enter 'p' to pick a chip, or any other key to quit the game: p

Strikes hit: 1

Digits placed: 1

Panel: $ _ 4 _ _ _

4 3 2 1 0

~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~

You picked the digit: 7

Which position do you think it is? 0

Correct, you picked the correct position!!!

Enter 'p' to pick a chip, or any other key to quit the game: p

Strikes hit: 1

Digits placed: 2

Panel: $ _ 4 _ _ 7

4 3 2 1 0

~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~

You picked the digit: 3

Which position do you think it is? 1

Sorry! You guessed the wrong position

Enter 'p' to pick a chip, or any other key to quit the game: 6

Strikes hit: 1

Digits placed: 2

Panel: $ _ 4 _ _ 7

4 3 2 1 0

~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~-^-~

Sorry, you lost the game!

The price of the car was: $54307

Do you want to play again (y/n)? Y

When the user loses, everything must be erased and the game starts over.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!