while A[Lo] < Middo
Inc(Lo);
while A[Hi] > Middo
Dec(Hi);
if Lo <= Hi then
begin
T := A[Lo];
A[Lo] := A[Hi];
A[Hi] := T;
Inc(Lo);
Dec(Hi);
end;
until Lo > Hi;
procedure TForm1.Button3Click(Sender: TObject);
var
i: Integer;
sl: array[0..10] of Integer;
s: String;
begin
Randomize;
for i := 0 to 10do
sl := Random(1000);
Sort(sl);
for i := 0 to 10do
s := s + '|' + IntToStr(sl);
ShowMessage(s);
end;