Question: 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:

  1. 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).
  2. Assume the numbers entered are sorted in order from smallest to largest.
  3. 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!