Question: C++ Language Task 5 simulates the answer to the greatest dodgeball player of all time while using functions. In the land of dodgeball mania, Player

 C++ Language Task 5 simulates the answer to the greatest dodgeball

C++ Language

Task 5 simulates the answer to the greatest dodgeball player of all time while using functions. In the land of dodgeball mania, Player A, Player B, and Player C had an argument over which one of them was the greatest dodgeball player of all time. To end the argument once and for all, they agreed on a dodgeball duel. Player A is a poor shooter and only hits his target with a probability of 1/3. Player B is a bit better and hits their target with a probability of 1/2. Player C is an expert shooter and never misses. A hit means a part of another player was hit with the ball and that person hit drops out of the duel. To compensate for the inequities in their marksmanship skills, it is decided that the contestants would fire in turns starting with Player A, followed by Player B, and then by Player C. The cycle would repeat until there was one man standing. And that player would be remembered as the greatest dodgeball player of all time. a. Write a function to simulate a single shot. It should use the following declaration: void shoot (bool &targetAlive, double accuracy) This would simulate someone shooting at targetAlive with the given accuracy by generating a random number between 0 and 1. If the random number is less than accuracy, then the target is hit and targetAlive should be set to false. You need to generate random numbers. For example, if Player B is shooting at Player C, this would be invoked as: shoot (PlayerCAlive, 1.0); Here, PlayerCAlive is a Boolean variable that indicates if Player C is alive. These constants are setup already: // Constants const float PLAYERA_ACCURACY const float PLAYERB ACCURRACY const float PLAYERC ACCURACY const int NUMDUELS = 100/3; = 50; = 100; = 1000

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!