急!急!急!一个小程序,请高手看一下问题出在哪啊?
为什么不可以调试和运行?问题出在哪啊? #include "math.h"
double ffts(a,b,eps,f)
double a,b,eps,(*f)();
{ int n,k;
double fa,fb,h,t1,p,s,x,t;
fa=(*f)(a); fb=(*f)(b);
n=1; h=b-a;
t1=h*(fa+fb)/2.0;
p=eps+1.0;
while (p>=eps)
{ s=0.0;
for (k=0;k<=n-1;k++)
{ x=a+(k+0.5)*h;
s=s+(*f)(x);
}
t=(t1+h*s)/2.0;
p=fabs(t1-t);
t1=t; n=n+n; h=h/2.0;
}
return(t);
}
#include "stdio.h"
#include "9ffts.c" (注:9ffts.c为上面函数文件名 )
double e;
main()
{ double a,b,eps,t1,t2,e,sum,fftsf(double);
scanf("%lf",&e);
a=0.0; b=1.0; eps=0.000001;
t1=ffts(a,b,eps,fftsf);
a=0.0; b=1.0; eps=0.000001;
t2=ffts(a,b,eps,fftsf);
sum=t1+t2;
printf("\n");
printf("sum=%e\n",sum);
printf("\n");
return 0;
}
#include "math.h"
double fftsf(double x)
{double y;
double z=0.5;
y=16.7*((2.0*(e-z*x))/0.002-((e-z*x)/0.002)*((e-z*x)/0.002));
return(y);
}