error C2059: syntax error : 'type'错误

来源:百度知道 编辑:UC知道 时间:2024/06/18 17:42:32
#include "stdlib.h"
#include "math.h"

float max(float x1,float x2)
{
if(x1<x2)
return x2;
else return x1;
}
float min(float x1,float x2)
{
if(x1<x2)
return x1;
else return x2;
}
float fun(float x);
float quan(float *px,float h,float eps ,int limit)
{
float f0,f1,f2,f3,x,f,c1,c2;
float a,b,k;
float x0,x1,x2,x3;
float h0=h;
x0=*px;
f0=fun(x0);x1=x0+h0;f1=fun(x1);
if(f1<f0)goto s10;
x2=x0+h0;h0=-h0;
s10:if(fabs(h0)>1.0e10)goto s90;
x1=x0+h0;f1=fun(x1);
if(f1>f0) goto s20;
h0=h0*2.0;x2=x0;x0=x1;f0=f1;goto s10;
s20: a=min(x1,x2);b=max(x1,x2);
x2=x0;x1=a;x3=b;k=1;
s30: k=k+1;
if(k>limit) goto s95;
f1=fun(x1);f2=fun(x2);f3=fun(x3);
c1=(f3-f1)/(x3-x1);c2=((f2-f1)/(x2-x1)-c1)/(x2-x3);