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!
#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 continueStep 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