Question: C++ Coding (5-6 Please make code Copy and Paste-able , also this is an intro class so please nothing too advanced ) -needs to display
C++ Coding (5-6 Please make code Copy and Paste-able, also this is an intro class so please nothing too advanced)


-needs to display each duel info along the way.
-needs to re-seed the random number generator.
6. In the land of Puzzlevania, Aaron, Bob, and Charlie had an argument over which one of them was the greatest puzzler of all time. To end the argument once and for all, they agreed on a duel to the death. Aaron is a poor shooter and only hits his target with a probability of 1/3. Bob is a bit better and hits his target with a probability of 1/2. Charlie is an expert marksman and never misses. A hit means a kill and the 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 Aaron, followed by Bob, and then by Charlie. The cycle would repeat until there was one man stand- ing. And that man would be remembered as the greatest puzzler of all time. a. Write a function to simulate a single shot. It should use the following declaration void shoot Cbool& 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. Chapter 4 illustrates how to generate random numbers. For example, if Bob is shooting at Charlie, this could be invoked as: shoot CharlieAlive, 0.5); Here, charlieAlive is a Boolean variable that indicates if Charlie is alive. 6. In the land of Puzzlevania, Aaron, Bob, and Charlie had an argument over which one of them was the greatest puzzler of all time. To end the argument once and for all, they agreed on a duel to the death. Aaron is a poor shooter and only hits his target with a probability of 1/3. Bob is a bit better and hits his target with a probability of 1/2. Charlie is an expert marksman and never misses. A hit means a kill and the 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 Aaron, followed by Bob, and then by Charlie. The cycle would repeat until there was one man stand- ing. And that man would be remembered as the greatest puzzler of all time. a. Write a function to simulate a single shot. It should use the following declaration void shoot Cbool& 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. Chapter 4 illustrates how to generate random numbers. For example, if Bob is shooting at Charlie, this could be invoked as: shoot CharlieAlive, 0.5); Here, charlieAlive is a Boolean variable that indicates if Charlie is alive
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
