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].

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section6.4: A Case Study: Rectangular To Polar Coordinate Conversion
Problem 9E: (Numerical) Write a program that tests the effectiveness of the rand() library function. Start by...
icon
Related questions
Question

Actually, I am sending this question two times, the earlier one a minute ago i forget to say I want you to use C++. 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 1 images

Blurred answer
Knowledge Booster
Concept of pointer parameter
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++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr