Question: Write a C++ program that simulates the random flipping of two coins. At the start of the program prompt the user for the amount of

Write a C++ program that simulates the random flipping of two coins. At the start of the program prompt the user for the amount of times to flip the coin. Display each flip, and afterward display the percentages of heads and tails for each coin. Also, display the percentage that both coins were heads, and the percentage both coins were tails. Output from your program might look like this:

How many times would you like to flip the coins?

2

H T

H H

Coin1 was heads 100%, and tails 0%

Coin2 was heads 50%, and tails 50%

The percentage both coins were heads was 50%

The percentage both coins were tails was 0%

Do you want to continue (Y/N)?

Y

How many times would you like to flip the coins?

5

H T

T H

H H

H H

T H

Coin1 was heads 60%, and tails 40%

Coin2 was heads 80%, and tails 20%

The percentage both coins were heads was 40%

The percentage both coins were tails was 0%

Do you want to continue (Y/N)?

n

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!