Simulate a coin toss and determines if it is realistic

Assignment Help Computer Engineering
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."

Reference no: EM132208504

Questions Cloud

Write a program that finds the area of a circle : Write a program called cirearea() that finds the area of a circle. It should take an argument of type float and return an argument of the same type.
Calculate statistical information on list of integer number : Return the double average and standard deviation via call by reference parameters. The function itself does not return anything.
Write a program that calculates the occupancy rate : Write a program that calculates the occupancy rate for a hotel. The program should start by asking the user how many floors the hotel has.
Calculate the balance of a savings account at the end : Write a program that calculates the balance of a savings account at the end of a period of time.
Simulate a coin toss and determines if it is realistic : Prompt the user to enter the number of times the coins should be tossed. The coin should be tossed at least 10 times.
Calculate and print the sum of the first 100 even numbers : Write a program to calculate and print the sum of the first 100 even numbers. Hint: You need a running sum.
Display the contents of the first array : Write a program in C that uses two identical arrays of just eight intergers. Display the contents of the first array, then call a function to sort.
Write a program to compute the pressure of water at depths : Write a program to compute the pressure of water at depths of 150, 200, and 250 ft.
Utilize a fraction struct that has a numerator : Make an overloaded operator > that can compare two Fractions and determine whether the first one is greater than the second one.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Implement the playexpert mode of the game

Whether or not you have managed to implement the playExpert mode of the game. If you do not manage to implement it you should carry on with the rest of the questions in novice mode.

  How many different lines could potentially be

How would the bits of the address be used to indicate the set, line, word and byte? How many different lines could potentially be in a given cache entry?

  What are the security and privacy risks and vulnerabilities

What are the security and privacy risks and vulnerabilities in using the Internet? List some specific common attack strategies and describe how they work and their effects/consequences on the security and privacy.

  You have been hired by tmi to design an application using

you have been hired by tmi to design an application using shell script programs. tmi case projects needs you to design

  What is maximum depth of recursion in function solve-from

What is the maximum depth of recursion in the function solve_from? Construct the recursion tree of all situations that the function solve_from will consider.

  How a new hiring system would support that strategy

Using the Business Strategy statement and information from the Case Study, explain how a new hiring system would support that strategy.

  Create user - itstaff with local administrator privileges

The hospital needs to display a HIPPA warning reminding employees of patient confidentiality requirements to all employees when they log on.

  Write down an application that displays a menu

Write down an application that displays a menu.

  Create a simple system to read merge purge eclipse data

"Create a simple system to read, merge, purge, sort, search, and write eclipse data with error checking and providing fast lookup by catalog number."

  When interrupts are enabled

Which of the following for the 9S12G128 microcontroller cannot be configured to process an interrupt. For the 9S12G128 microcontroller, when the power-on reset is activated, who provided the ISR memory address for the Reset ISR

  Write your mini-security policy in detail

In reading the excerpt from the textbook on what happened and how Snowden was able to access the data that he did, write a mini-security policy following.

  Tradeoff between breath first search, depth-fisrt-search

tradeoff between Breath First search, Depth-Fisrt-Search.Directed Acyclic Graphs(DAGs), Topological sorting and Dijkstra.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd