Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

5.4 Write the function header (function prototype) for each of the following functions. ction hypotenuse that ta double- precision floating- point arguments, side1 and side2,

image text in transcribed
5.4 Write the function header (function prototype) for each of the following functions. ction hypotenuse that ta double- precision floating- point arguments, side1 and side2, and returns a double- precision floating- point b) Function smallest that takes three integers, x, y, z, and returns an integer. c) Function instructions that does not receive any arguments and does not return a value. [ Note: Such functions are commonly used to display instructions to a user.] d) Function intToFloat that takes an integer argument, number, and returns a floating-point result. 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions