Question: home / study / engineering / computer science / questions and answers / This Program Will Find The Median Of A Set Of Numbers ...
home / study / engineering / computer science / questions and answers / This Program Will Find The Median Of A Set Of Numbers ...
Your question has been answered
Let us know if you got a helpful answer. Rate this answer
Question: This program will find the median of a set of numb...
This program will find the median of a set of numbers (the median is the middle number of a set of numbers which are sorted in ascending or descending sequence; if the number of values in the set is odd, the median is the middle number, but if the number of values is even, the median is the sum of the two middle numbers divided by two).
This program will use function Templates so the set of numbers can be either data type int or double.
In main declare a vector (s) to hold the set of numbers.
The program will have three function Templates:
-Fill_Vector: have the user enter and store an unknown number of numbers into the vector; validate that the numbers are zero or greater (see values below).
-Sort_Vector: sort the vector using the vector sort algorithm.
-Find_Median: determine the median of the numbers in the vector and return the median to main via the function's return type; use vector [] notation (or use vector iterator notation for 5 extra credit points).
Then in main, display the values in the sorted vector (must use iterator) and display the median (all displays to 1 decimal point).
Provide two screen prints with the following values:
1) 25, 4, 13, 1, 0, 9, 17, 29, 11
2) 25.25, 4.4, 1.1, 0.0, 9.9, 17.17, 29.29, -34.34 (should produce error, then enter 11.11)
Step by Step Solution
There are 3 Steps involved in it
To develop a program that finds the median of a set of numbers using function templates and vector operations in C follow these detailed steps Step 1 ... View full answer
Get step-by-step solutions from verified subject matter experts
