I did the best I can and stuck at the scanf part.

I thought float and double share the %f, but when i ran the test, it told me:

'warning: float format, double arg'

and I tried to use typedef to include my f() as an argument, but seems like a failure.

Help PLEASE,

Thank you

Code:

#include <math.h>
#include <stdio.h>
double f(double T0, double x, double y, double ymin, double w)
{
return ( (T0 / w) * cosh(w * x / T0) + ymin - T0 / w - y);
}
typedef double (*DfD) (double);
double find_root(DfD f, double Ta, double Tb, double tol)
{
double middle = (Ta + Tb)/2.0;
if ((middle - Ta)< tol)
return middle;
else if (f(middle,x,y,ymin,w)* f(Ta,x,y,ymin,w)<0.0)
return find_root(f,Ta,middle,tol);
else
return find_root(f,middle,Tb,tol);
}
int main(void)
{
double x, y, ymin, w;
double newy;
scanf("%f%f%f%f",&x,&y,&ymin,&w);
newy = &find_root;
return(0);
}