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

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section7.4: Arrays As Arguments
Problem 7E: (Statistics) Write a program that includes two functions named calcavg() and variance(). The...
icon
Related questions
Question

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
Array
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
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
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,