Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a complete C++ program called average.cpp that does the following. First it reads three integers and reports the median of those three integers. Next,
Write a complete C++ program called average.cpp that does the following.
-
First it reads three integers and reports the median of those three integers.
-
Next, it reads integers until it reads 1. It reports the mean of all of those integers, excluding the 1 at the end.
Example 1
If the input is
3 9 5 4 5 8 20 25 -1
then your program should say:
The median of (3, 9, 5) is 5. The mean of (4, 5, 8, 20, 25) is 12.40
Example 2
If the input is
3 6 3 2 4 6 -1
then your program should say:
The median of (3, 6, 3) is 3. The mean of (2, 4, 6) is 4.00.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started