看来您是使用Basic的专业人士,能麻烦您把下面的Pascal代码转成Basic吗?万分感激
program FQs;
var
a:array of longint;
l:longint;
i:longint;
procedure E(var a,b:longint);
var
c:longint;
begin
c:=a;
a:=b;
b:=c;
end;
procedure S(n,u:longint);
var
p,i,j:longint;
begin
if n+1=u then
begin
if a[n]>a[u] then E(a[n],a[u]);
end
else
begin
p:=a[n];
i:=n;
j:=u+1;
repeat
i:=i+1;
j:=j-1;
if i=j then
begin
if p<a[i] then
begin
E(a[n],a[i-1]);
if n<(i-1)-1 then S(n,(i-1)-1);
if (i-1)+1<u then S((i-1)+1,u);
Exit;
end
else
begin
E(a[n],a[i]);
if n<i-1 then S(n,i-1);
if i+1<u then S(i+1,u);
Exit;
end;
end
else
begin
for i:=i to j-1 do
if a[i]>p then break;
if i+1<j then
begin
for j:=j downto i+1 do
if a[j]<p then break;
E(a[i],a[j]);
if j-1=i then
begin
if p<a[i] then
begin
E(a[n],a[i-1]);
if n<(i-1)-1 then S(n,(i-1)-1);
if (i-1)+1<u then S((i-1)+1,u);
Exit;
end
else
begin
E(a[n],a[i]);
if n<i-1 then S(n,i-1);
if i+1<u then S(i+1,u);
Exit;
end;
end;
end
else
begin
if a[i]>a[j] then
E(a[i],a[j]);
if p<a[i] then
begin
E(a[n],a[i-1]);
if n<(i-1)-1 then S(n,(i-1)-1);
if (i-1)+1<u then S((i-1)+1,u);
Exit;
end;
if p=a[i] then
begin
if n<i-1 then S(n,i-1);
if i+1<u then S(i+1,u);
Exit;
end;
if p>a[i] then
if p<=a[j] then
begin
E(a[n],a[i]);
if n<i-1 then S(n,i-1);
if i+1<u then S(i+1,u);
Exit;
end
else
begin
E(a[n],a[j]);
if n<j-1 then S(n,j-1);
if j+1<u then S(j+1,u);
Exit;
end;
end;
end;
until (i+1=j) or (i=j);
end;
end;
begin
a:=[];
readln(l);
setlength(a,l);
for i:=0 to l-1 do
read(a[i]);
readln;
S(0,l-1);
for i:=0 to l-1 do
write(a[i],' ');
writeln;
end.