LZ,不是我说,你的C语言基础实在太差,很多概念你根本在瞎用,这样你不可能写好这个程序的,我帮你改掉了所有的编译错误和警告,现在可以顺利通过编译了,不过逻辑错误我就无能为力了,你自己好自为之吧。
double f11(double x,double e,double z)
{
if ((e<=0.002)&&(e>=0.0))
return 16.7*((2.0*(e-z*x))/0.002-((e-z*x)/0.002)*((e-z*x)/0.002));
else if ((e<=0.0033)&&(e>=0.002))
return 16.7*((1.0-0.15*((e-z*x)-0.002)/0.0013));
else return 0;
}
double f12(double x,double z,double e)
{
return 16.7*((2.0*(e-z*x))/0.002-((e-z*x)/0.002)*((e-z*x)/0.002));
}
double ffts(double x,double e,double z, double (*func)(double,double,double))
{
double y;
y=func(x,e,z);
return y;
}
#include "stdio.h"
//#include "9ffts.c"
int main(void)
{
double a,eps,e,k;
double z,xx1,xx2,gh1,t11,b;
double t12,h0,yn;
scanf("%lf",&e);
k=0.50;
h0=315.0;
z=0.0;
while ((e<=0.0033)&&(e>0))
z=e/(k*h0);
xx1=300.00;
xx2=-300.00;
gh1=0.002/z; //(****************)
{
a=0.0; b=k*h0-gh1; eps=0.000001;
t11=ffts(a,b,eps,f11);
a=k*h0-gh1; b=k*h0; eps=0.000001;
t12=ffts(a,b,eps,f12);
yn=t11+t12;
while ((xx2<=yn)&&(yn<=xx1))
z=e/(k*h0);
if (yn<xx2)
do {k=k+0.0001;}
while (xx2<=yn);
if (yn>xx1)
do {k=k-0.0001;}
while (yn<=xx1);
}
printf("z= %f,yn= %f\n",z,yn);
return 0;
}
double f11(double x,double e,double z)
{
if ((e<=0.002)&&(e>=0.0))
return 16.7*((2.0*(e-z*x))/0.002-((e-z*x)/0.002)*((e-z*x)/0.002));
else if ((e<=0.0033)&&(e>=0.002))
return 16.7*((1.0-0.15*((e-z*x)-0.002)/0.0013));
else return 0;
}
double f12(double x,double z,double e)
{
return 16.7*((2.0*(e-z*x))/0.002-((e-z*x)/0.002)*((e-z*x)/0.002));
}
double ffts(double x,double e,double z, double (*func)(double,double,double))
{
double y;
y=func(x,e,z);
return y;
}
#include "stdio.h"
//#include "9ffts.c"
int main(void)
{
double a,eps,e,k;
double z,xx1,xx2,gh1,t11,b;
double t12,h0,yn;
scanf("%lf",&e);
k=0.50;
h0=315.0;
z=0.0;
while ((e<=0.0033)&&(e>0))
z=e/(k*h0);
xx1=300.00;
xx2=-300.00;
gh1=0.002/z; //(****************)
{
a=0.0; b=k*h0-gh1; eps=0.000001;
t11=ffts(a,b,eps,f11);
a=k*h0-gh1; b=k*h0; eps=0.000001;
t12=ffts(a,b,eps,f12);
yn=t11+t12;
while ((xx2<=yn)&&(yn<=xx1))
z=e/(k*h0);
if (yn<xx2)
do {k=k+0.0001;}
while (xx2<=yn);
if (yn>xx1)
do {k=k-0.0001;}
while (yn<=xx1);
}
printf("z= %f,yn= %f\n",z,yn);
return 0;
}