Reference no: EM132208504
Write a program in C++ that simulates a coin toss and determines if it is realistic.
For each toss of the coin, the program should print "Heads" or "Tails".
Prompt the user to enter the number of times the coins should be tossed. The coin should be tossed at least 10 times. Include an input validation statement to enforce this request.
Count the number of times each side of the coin appears.
Your program should call a separate function that takes no arguments, but returns 0 for heads and 1 for tails.
Format your output so that 10 tosses are printed per line.
Your program will call another function to determine if the simulation was realistic. This function will accept the number of heads (or the number of tails) as well as the number of tosses as arguments.
If the selected side of the coin appears approximately half of the time, (between 45% and 55%) return true. Your code should print "This simulation was realistic."
Otherwise, your code should print "This simulation was not realistic."