procedure qSort(var ar:array[low..high]of real; low,high:integer); var i,j:integer; m,wsp:real; begin i:=low; j:=high; m:=ar[(i+j) div 2]; repeat while(ar[i]<m) do i:=i+1; while(ar[j]>m) do j:=j-1; if(i<=j) then begin wsp:=ar[i]; ar[i]:=ar[j]; ar[j]:=wsp; i:=i+1; j:=j-1; end; until (i > j); if(low<j) then qSort(ar,low,j); if(i<high) then qSort(ar,i,high); end;
var ar:array[low..high]of real; i:integer; begin randomize;
for i:=low to high do ar[i]:=random(101)-50; qSort(ar,low,high); writeln; for i:=low to high do write(ar[i],' '); end.
const low=1; high=10;
procedure qSort(var ar:array[low..high]of real; low,high:integer);
var i,j:integer;
m,wsp:real;
begin
i:=low;
j:=high;
m:=ar[(i+j) div 2];
repeat
while(ar[i]<m) do i:=i+1;
while(ar[j]>m) do j:=j-1;
if(i<=j) then begin
wsp:=ar[i];
ar[i]:=ar[j];
ar[j]:=wsp;
i:=i+1;
j:=j-1;
end;
until (i > j);
if(low<j) then qSort(ar,low,j);
if(i<high) then qSort(ar,i,high);
end;
var ar:array[low..high]of real;
i:integer;
begin
randomize;
for i:=low to high do ar[i]:=random(101)-50;
qSort(ar,low,high);
writeln;
for i:=low to high do write(ar[i],' ');
end.