Reference no: EM132218449
Use c++ to write a function called median that returns the median entry in a 1-dimensional array of integers.
For example, if we have an array a={3,4,5,1,6}; then the median entry of this array a is 4.
You need to sort the array a first, to get {1,3,4,5,6}, then find the entry in the middle position.
If the array size is even, it means that array has even number of elements.
For example, a={3,2,4,1}, then first sort it, a becomes {1,2,3,4}, then the median entry will be the average of 2 and 3, which is 2.5.
Note:i would prefer using void or int instead of float.