I have written an integration function (of one variable)
double integrate(double (*f)(double), const double a, const double b)
However, now I want to integrate a function of one variable, but the c++ function has an additional parameter:
double f(double x, bool flag)
{
if(flag == true)
f = pow(x,2);
else
f = pow(x,3);
}
I can't pass that to my integrate() function because it has the wrong number of arguments. How do you get around this?
Thanks,
Dave