主题:pascal 的一个直接插入排序的问题(高手请看)
program InsertSort;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
i,j,t:integer;
AX:array[0..3]of integer;
begin
{ TODO -oUser -cConsole Main : Insert code here }
for i:=0 to High(AX) do
begin
write('-----------:');
read(AX[i]);
end;
for i:=0 to High(AX) do
begin
t:=AX[i];
for j:=i-1 downto 0 do
if t<AX[j] then AX[j+1]:=AX[j]
else AX[j+1]:=t;
end;
for i:=0 to High(AX) do
writeln(AX[i]);
sleep(10000);
end.
---------------------------------
跪求,如何修改??
{$APPTYPE CONSOLE}
uses
SysUtils;
var
i,j,t:integer;
AX:array[0..3]of integer;
begin
{ TODO -oUser -cConsole Main : Insert code here }
for i:=0 to High(AX) do
begin
write('-----------:');
read(AX[i]);
end;
for i:=0 to High(AX) do
begin
t:=AX[i];
for j:=i-1 downto 0 do
if t<AX[j] then AX[j+1]:=AX[j]
else AX[j+1]:=t;
end;
for i:=0 to High(AX) do
writeln(AX[i]);
sleep(10000);
end.
---------------------------------
跪求,如何修改??