Question: So I'm currently working on a median value program and I'm having difficulty with it. Below is the scratch work but I'm having difficulty because

So I'm currently working on a median value program and I'm having difficulty with it. Below is the scratch work but I'm having difficulty because it requires to use pointer notation. I'm getting many errors on Visual Studio. Any help would be greatly appreciated! So I'm currently working on a median value program and I'm having

#include

using namespace std;

int getMedian(double*a[], int);

int getMedian(double*a[], int)

{

int midIndex = 0;

double median = 0;

int i;

if ((i % 2) != 0)

{

midIndex = ((i % 2));

&median = a[midIndex];

return median;

}

else

{

midIndex = i / 2;

median = ((a[midIndex] + a[midIndex + 1]) / 2);

return median;

}

}

int main()

{

int number;

double *array;

int median = 0;

cout

cin >> number;

cout

array = new int[number];

median = getMedian(*a[], number);

cout

cout

cin >> number;

cout

median = getMedian(*a[], number);

cout

}

cCWindows'system32\cmd.exe The values of array one are 1 3 The median of array one is 3 The values of array two are 2 4 5 9 The nedian of array two is 4.5 Press any key to continue

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!