c++ – …redeclared as different kind of symbol?

c++ – …redeclared as different kind of symbol?

You are redefinign low and high inside the function which clash with those defined in the parameters.

The for loop is doing

for(x=low;x<=high;x++)
{
   delta_x = x+delta_x;
}

did you mean it to do

for(x=low;x<=high;x++)
{
   delta_x = x+delta_x;
   ans = delta_x*s;
}

However I think you wanted to do ans += delta_x*s;

lowand high are already passed as parameters of your integrateF method. But they are redeclared again inside the method. Hence the error.

c++ – …redeclared as different kind of symbol?

low and high are already passed as parameters of your integrateF method and they are redeclared again inside the method..

And x is not assigned a value when it is using for the calculation of s..


double x, ans;
double s = 1/2*exp((-x*x)/2);


Leave a Reply

Your email address will not be published.