Sort(aa);
for i := 0 to high(aa) do
begin
if aa[i] = a0 then
Memo1.Lines.Add('a0='+inttostr(aa[i]));
if aa[i] = a1 then
Memo1.Lines.Add('a1='+inttostr(aa[i]));
if aa[i] = a2 then
Memo1.Lines.Add('a2='+inttostr(aa[i]));
if aa[i] = a3 then
Memo1.Lines.Add('a3='+inttostr(aa[i]));
end;
end;
procedure TForm12.Sort(var x: array of integer);
var
i, j, l: integer;
begin
for i := 0 to high(x) do
begin
for j := 0 to high(x) - 1 do
begin
if x[j] > x[j + 1] then
begin
l := x[j];
x[j] := x[j + 1];
x[j + 1] := l;
end;
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
a1,a2,a3,a4,a5:Integer;
aa:array [0..4] of Pint;
i,j:Integer;
procedure BubbleSort(b:array of Pint);
var
i,j,p:Integer;
t:Pint;
a:array of Integer;
begin
SetLength(a,Length(b));
for i:=Low(B) to High(B) do
a[i]:=b[i]^;
for i:=Low(A) to High(A)-1 do
for j:=i+1 to High(A) do
if a[i]>a[j] then
begin
p:=a[i];
a[i]:=a[j];
a[j]:=p;
end;
for i:=Low(B) to High(B) do
b[i]^:=a[i];