Question: LAB ACTIVITY 6 . 2 3 . 1 : LAB: Flip a coin 8 1 0 Define a function named CoinFlip that returns Heads or
LAB
ACTIVITY
: LAB: Flip a coin
Define a function named CoinFlip that returns "Heads" or "Tails" according to a random value or Assume the value represents "Heads" and represents "Tails". Then, write a main program that reads the desired number of coin flips as an input, calls function CoinFlip repeatedly according to the number of coin flips, and outputs the results. Assume the input is a value greater than
Hint: Use the modulo operator to limit the random integers to and
Ex: If the random seed value is and the input is:
the output is:
Tails
Heads
Tails
Note: For testing purposes, a pseudorandom number generator with a fixed seed value is used in the program. The program uses a seed value of during development, but when submitted, a different seed value may be used for each test case.
The program must define and call the following function:
string CoinFlip
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
