Var a,b,c,d,temp:real;
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;
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.