Hello all,
I am having a problem with a c++ assignment. The basic problem is that I have two functions -- one to compute the mean and and one to compute the variance of a subarray from a main array -- arraym.I keep getting an extra parameter in call error when I try to compile. Here are my functions:
//mean function
double mean(int arraym[299][299], int minl, int minw, int rlm, int rwm)
{
double sum(0);
int n(0);
for (int x=minl; x<=rlm; x++)
{
for (int y=minw; y<=rwm; y++)
{
sum += arraym[x][y];
n++;
}
}
return sum/n;
}
//variance function
double variance(int arraym[299][299], int minl, int minw, int rlm, int rwm)
{
double sum(0), me;
int n(0);
me = mean(arraym, minl, minw, rlm, rwm);
for (int x=minl; x<=rlm; x++)
{
for (int y=minw; y<=rwm; y++)
{
sum += (arraym[x][y] - me)*(arraym[x][y] - me);
n++;
}
}
return sum/(n-1);
}
and here is my function call:
double y;
y = variance(arraym[299][299], minl, minw, rlm, rwm);
any ideas why I would be getting this error? minl and minw are the starting sub-array offsets and rlm and rwm are the ending sub-array offsets. Everything else is declared correctly elsewhere in my code.
Thanks in advance