procedure TForm7.Button1Click(Sender: TObject);
var
a,b,c,d,e,t1,t2,temp:real;
function largest(d1,d2,d3:real):real;
var
cul:real;
begin
if d1>d2 then cul:=d1 else cul:=d2;
if d3>cul then cul:=d3;
largest:=cul
end;
begin
t1:=largest(a,b,c);
t2:=largest(d,e,t1)
end;
begin
if a<t2 then
begin
temp:=t2; t2:=a;a:=temp;
end;
end;
edit1.text:=floattostr(a);
edit2.text:=floattostr(b);
edit3.text:=floattostr(c);
edit4.text:=floattostr(d);
end.
var
a,b,c,d,e,t1,t2,temp:real;
function largest(d1,d2,d3:real):real;
var
cul:real;
begin
if d1>d2 then cul:=d1 else cul:=d2;
if d3>cul then cul:=d3;
largest:=cul
end;
begin
t1:=largest(a,b,c);
t2:=largest(d,e,t1)
end;
begin
if a<t2 then
begin
temp:=t2; t2:=a;a:=temp;
end;
end;
edit1.text:=floattostr(a);
edit2.text:=floattostr(b);
edit3.text:=floattostr(c);
edit4.text:=floattostr(d);
end.
解决方案 »
- wordApplication,quit时,提示是否保存。能不能不提示?因为不需要保存
- 有哪位高手知道这个程序错在哪里!
- DELPHI 7下IDFTP编的FTP程序,在WIN7下用不了,如何解决?
- delphi7的tdatabase控件在什么位置啊,我怎么在data access中找不到啊
- 关于TADOQuery 用法问题(高手请进)
- 关于实现分组的问题!!!
- 偶打算以后将灌水基地转移到这里了
- How to be a programer?大家请进
- 用DBExpress连接SQL SERVER时,SQLConnection连接成功,但commandtext却没有table和field列表?
- 连接SQL Server除了sa还可以用哪些帐户?
- Delphi 数据库不如Power Builder 吗?
- 报表生成器免费源代码,哪来就能用了呀!!!!~
begin
a:=10.5;b:=9.5;c:=11.5;d:=12;
temp:=max(max(max(a,b),c),d);
if b=temp then b:=a
else if c=temp then c:=a
else if d=temp then d:=a;
a:=temp;
temp:=max(max(b,c),d);
if c=temp then c:=b
else if d=temp then d:=b;
b:=temp;
temp:=max(c,d);
if temp=d then d:=c;
c:=temp;
edit1.text:=floattostr(a);//最大
edit2.text:=floattostr(b);
edit3.text:=floattostr(c);
edit4.text:=floattostr(d);//最小
end;
uses math;
a,b,c,d,tmp,max:Integer;
Numbers:array [0..3] of PInteger //指针数组
begin
//assign a,b,c,d
.....
Numbers[0]=@a;
Numbers[1]=@b;
Numbers[2]=@c;
Numbers[3]=@d; max:=0;
for i:=0 to 3 do
begin
if Numbers[i]^>Numbers[max]^ then max:=i;
end tmp:=a;
a:=Numbers[max]^;
Numbers[max]^=tmp;
end;end;