我用C++写的龙贝格算法无法运行,请高手们帮忙看看
#include<iostream>#include<cmath>
using namespace std;
double f(double x);
double zt2(double,double,double,double);
double zs2(double,double);
double zc2(double,double);
double zr2(double,double);
const double e=0.00001;
int main()
{
double a,b,h,t1,t2,c1,c2,s1,s2,r1,r2;
int k;
k=1;
cout<<"please input a and b"<<endl;
cin>>a>>b;
h=b-a;
t1=h/2*(f(a)+f(b));
t2=zt2(t1,h,a,b);
s2=zs2(t2,t1);
k=k+1;
h=h/2;
t1=t2;
s1=s2;
t2=zt2(t1,h,a,b);
s2=zs2(t2,t1);
h=h/2;
c2=zc2(s2,s1);
c1=c2;
s1=s2;
t1=t2;
t2=zt2(t1,h,a,b);
s2=zs2(t2,t1);
c2=zc2(s2,s1);
r2=zr2(c2,c1);
k=k+1;
h=h/2;
r1=r2;
c1=c2;
s1=s2;
t1=t2;
t2=zt2(t1,h,a,b);
s2=zs2(t2,t1);
c2=zc2(s2,s1);
r2=zr2(c2,c1);
for(k=4;abs(r2-r1)<e;k++)
{
h=h/2;
r1=r2;
c1=c2;
s1=s2;
t1=t2;
t2=zt2(t1,h,a,b);
s2=zs2(t2,t1);