Use C++, I have got your solution, but you have not created sort function. Could you please use sort function as well? Thank you. Median Function – In statistics, the median of a set of values is the value that lies in the middle when the values are arranged in sorted order.   If the set has an even number of values, the median is the average of the two middle values.  Your program should start with two arrays of integers containing the following values: Even numbered array:  17 32 45 68 99 101 67 89 22 27 Odd numbered array:   17 32 45 68 99 101 67 89 22 Using a sort function of your choice, first sort the arrays.  NOTE:  you may use the Standard Template Library sort function or your own sort function. Then, write a function that determines the median of a sorted array.   The function should take an array of numbers and an integer indicating the size of the array and return the median of the values in the array.   The same function should be called twice – once for the even array and once for the odd array.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter16: Searching, Sorting And Vector Type
Section: Chapter Questions
Problem 17PE
icon
Related questions
Question

Use C++,

I have got your solution, but you have not created sort function. Could you please use sort function as well? Thank you.

Median Function – In statistics, the median of a set of values is the value that lies in the middle when the values are arranged in sorted order.   If the set has an even number of values, the median is the average of the two middle values. 

Your program should start with two arrays of integers containing the following values:

Even numbered array:  17 32 45 68 99 101 67 89 22 27

Odd numbered array:   17 32 45 68 99 101 67 89 22

Using a sort function of your choice, first sort the arrays.  NOTE:  you may use the Standard Template Library sort function or your own sort function.

Then, write a function that determines the median of a sorted array.   The function should take an array of numbers and an integer indicating the size of the array and return the median of the values in the array.   The same function should be called twice – once for the even array and once for the odd array.

Your program should also have a printArray function that can be used to print the sorted array. (It should be called twice, once for each array).   It should be passed the array and its size.

Modularity – In addition to the main function, your program should have a sort function, the median function, and the printArray function. 

When an array is passed to the median and printArray functions, it should be passed using pointer notation.  Within each of these two functions, the array should be referred to by pointer notation.  In other words, use *(arr + n) instead of arr[n]. 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning