implementation
{$R *.dfm}
function f(x:Real):Real;
begin
f:=2*x;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
i,x,y,s,b: Real;
n,j:Integer;
const
a=1;
H=99;
m=100;
begin
Button1.Caption:= '积分结果 ';
j:= StrToInt(edit1.Text); //分成j等分,edit1中先输入的值
i:=(b-a)/j;
y:=0;
for n:=1 to j do
begin
x:= a+(n-1)*i ;
y:=y+ f(x); //即f(a)+f(a+i)+f(a+2i)+···的值
end;
s:=y*(b-a)/j ; //总面积的值
for b:= a to m do
begin
If s=H then
break;
end;
If s=H then
b:=b;
end;
edit1.Text:='';
edit1.Text:= floattostr(b);
end;
end.
{$R *.dfm}
function f(x:Real):Real;
begin
f:=2*x;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
i,x,y,s,b: Real;
n,j:Integer;
const
a=1;
H=99;
m=100;
begin
Button1.Caption:= '积分结果 ';
j:= StrToInt(edit1.Text); //分成j等分,edit1中先输入的值
i:=(b-a)/j;
y:=0;
for n:=1 to j do
begin
x:= a+(n-1)*i ;
y:=y+ f(x); //即f(a)+f(a+i)+f(a+2i)+···的值
end;
s:=y*(b-a)/j ; //总面积的值
for b:= a to m do
begin
If s=H then
break;
end;
If s=H then
b:=b;
end;
edit1.Text:='';
edit1.Text:= floattostr(b);
end;
end.
![](http://g.hiphotos.baidu.com/album/s%3D740%3Bq%3D90/sign=96619aa68618367aa9897dd91e48fae9/4ec2d5628535e5ddc121f25076c6a7efce1b622b.jpg?v=tbs)