#include<iostream.h>
#include<math.h>
double f(double x)
{
if(x==0)
return 1;
else
return sin(x)/x;
}
double ff(double a,double b,double c)
{
double h=b-a;
double t1,t2=0,x,s=0;
t1=(h/2)*(f(a)+f(b));
while(fabs(t2-t1)>c)
{
s=0;x=a+h/2;
t1=t2;
while(x<b)
{
s+=f(x);x+=h;
}
t2=t1/2+(h/2)*s;
h=h/2;
}
return t2;
}
void main()
{
double a,b,c;
cout<<"请分别输入上下限"<<endl;
cin>>a>>b;
cout<<"请输入误差限度:"<<endl;
cin>>c;
cout<<ff(a,b,c)<<endl;
}