delphi7冒泡排序作业
本帖最后由 up360 于 2023-10-18 22:16 编辑https://i.postimg.cc/yxYNt6zB/2023-10-18-215634.png
procedure TForm1.Button2Click(Sender: TObject);
var
i,j:Integer;
begin
i:=1;
j:=1;
n:=n-1;
showmessage(inttostr(n));
For i:=1 To n-1 do
begin
For j:=1 To n-i do
begin
If shuzu>shuzu Then
begin
m:=shuzu;
shuzu:=shuzu;
shuzu:=m;
end;
end;
end;
For i:=1 To n do
Label2.Caption:=Label2.Caption+''+IntToStr(shuzu);
end;
页:
[1]