错的很严重
一般书上都有标程的
我把我的程序给你吧
program quick;
var n,i:longint;
a:array[1..100000] of longint;
procedure swap(var x,y:longint);
var t:longint;
begin
t:=x;x:=y;y:=t;
end;
procedure qs(l,r:longint);
var i,j,x:longint;
begin
x:=a[l];i:=l;j:=r;
repeat
while(i<j) and(a[j]>a) do dec(j);
if(i<j) then begin swap(a,a[j]);inc(i);end;
while (i<j) and(a<a[j]) do inc(i);
if (i<j) then begin swap(a[j],a);dec(j);end;
until i=j;
a:=x;
if l<i-1 then qs(l,i-1);
if i+1<r then qs(i+1,r);
end;