Question: Function Program - C++ You are to write a program that will input any four float values where the four variables (cin in the values)
Function Program - C++ You are to write a program that will input any four float values where the four variables (cin in the values) that are declared in the 'main' function ( not global variables) and perform the following calculations in functions: Have your functions return their values through the return (return value). Do not return values through a pass-by-ref parameter unless otherwise stated. 0. read in one float number. You will call this function 4 times. 1. print out the four numbers (one argument function), the sum (two argument function), and the average of the four numbers (two argument function). (Three functions) 2. print out the difference between the first and second number and the difference between the third and fourth number. (one function called twice.) 3. print out the first number raised to the second number power (pow function) and the fourth number raised to the third number power. (one function called twice) 4. print out the largest of the four. (This function, you can only pass in two arguments at one time. You will call this function more than once.) 5. print out the smallest of the four. (This function, you can only pass in two arguments at one time. Same as the previous.) 6. print out the average of the three largest numbers using only the existing functions listed above. This is not a new function. 7. print out the average of the three smallest numbers using only the existing functions above. Same as previous. 8. print out a running total of the four numbers. Ex 10.243 17.775 33.288 .. using the Sum function. The sum function has only two arguments. Read in the following four numbers: 10.243 7.532 15.513 4.196 to test your code with. Turn in the source code and the output file. Restrictions: You have to use functions for each one of the above. The arguments must be passed by value and no pass by reference. You have to pass in two or less arguments into each function and pass back the results (See above restriction on arguments). The main program is the only place you can do couts, NO couts in any function. Your 'main' can only have couts statements and function calls.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
