Function Prototypes

Mar 22 2018 12:47 AM
5.31 (Coin Tossing) Write a program that simulates coin tossing. For each toss of the coin the program should print Heads or Tails. Let the program toss the coin 100 times, and count the number of times each side of the coin appears. Print the results. The program should call a separate function flip that takes no arguments and returns 0 for tails and 1 for heads. [Note: If the program realistically simulates the coin tossing, then each side of the coin should appear approximately half the time for a total of approximately 50 heads and 50 tails.]
 
Use an enum for the coin (heads/tails) so you can use a switch that has heads or tails as switch cases instead on 0 and 1.