Question
Write a C++ function called findMedian that takes two parameters - an array of int and the size of the array. The function should return
Write a C++ function called findMedian that takes two parameters - an array of int and the size of the array. The function should return the median of the array, which will require sorting the array. This will change the original array, but that's okay for this assignment.
For the following projects (and all future projects in this course):
Do not include a main method in the files you submit - just the definitions of the assigned functions. I will compile your code with my own main method for testing, and there can only be one main method in a program. You will of course need to have a main method for testing purposes - just make sure you comment it out (or delete it) before submitting your file.
Do not use any global variables. Global variables and their drawbacks are discussed on pages 357-9 of the textbook. If the assignment description doesn't specify a return value for a function, then it should have a return type of void.
The file must be named: findMedian.cpp.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started