Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a C++ program that will read in a sorted list of at most100 positive floating point numbers and will display the total number of
Write a C++ program that will read in a sorted list of at most100 positive floating point numbers and will display the total number of positive numbers entered and their median.
Notes:
- The median value of a list of numbers sorted in order from smallest to largest is the middle value of the numbers entered if the total number entered is odd; otherwise, the median is the average of the two middle values of the numbers entered. For example, the median of 1,2,3,4,5 is 3 (the middle value), while the median of 1,2,3,4,5,6 is 3.5 (the average of the two middle values).
- Assume the numbers entered are sorted in order from smallest to largest.
- Do not assume that the user knows the number of numbers to be entered in advance of entry.
Here is output from a sample run of the program (user input in bold):
Enter positive float #1: 2
Enter positive float #2 (0 to stop): 4
Enter positive float #3 (0 to stop): 6
Enter positive float #4 (0 to stop): 8
Enter positive float #5 (0 to stop): 0
Total number of numbers entered = 4
Median = 5
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