Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started