Question: 7.8 CH7 LAB: Flip a coin Write a program that simulates flipping a coin to make decisions. The input is how many decisions are needed,

7.8 CH7 LAB: Flip a coin Write a program that simulates flipping a coin to make decisions. The input is how many decisions are needed, and the output is either heads or tails. Assume the input is a value greater than O. If the input is 3, the output is: heads tails heads For reproducibility needed for auto-grading, seed the program with a value of 2. In a real program, you would seed with the current time, in which case every program runs output would be different, which is what is desired but can't be auto-graded. Your program must define and call a function: string HeadsorTails() that returns "heads" or "tails" NOTE: A common student mistake is to call srand0 before each call to randO. But seeding should only be done once, at the start of the program, after which rand0 can be called any number of times
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
