current code:
void showMedian(int *array, int size)
{
double middle;
double average;
middle = size / 2;
if ( middle % 2)
{
average = (*(array[middle]) + *(array[middle + 1])) / 2;
cout << "The median is: " << average << endl;
}
else
cout << "The median is: " << *(array[middle + .5]) << endl;
}
I know that % only works with int, and not doubles but what im trying to do is find the middle number of a set of numbers, if the set of numbers is even, then find the average of the two numbers.
im getting errors for average =