主题:5555555^^菜鸟求救~~
procedure TForm1.Button1Click(Sender: TObject);
var
arr:array[1..7] of integer;
i,j,temp:integer;
begin
for i:=1 to 7 do
begin
arr[i]:=i;
end; //end for
for i:=1 to 7 do
begin
for j:=1 to i do
begin
if arr[j]<arr[j+1] then
begin
temp:=arr[j];
arr[j]:=arr[j+1];
arr[j+1]:=temp;
end;//if
end;//j
end;//i
for i:=1 to 7 do
begin
edit1.Text:=edit1.Text+inttostr(arr[i]);
end;//i
end;
end.
请问这个冒泡是哪里错了呢??
怎么编译通过了,但是不能运行~~
请各位有时间的话帮我看看………………感激``
var
arr:array[1..7] of integer;
i,j,temp:integer;
begin
for i:=1 to 7 do
begin
arr[i]:=i;
end; //end for
for i:=1 to 7 do
begin
for j:=1 to i do
begin
if arr[j]<arr[j+1] then
begin
temp:=arr[j];
arr[j]:=arr[j+1];
arr[j+1]:=temp;
end;//if
end;//j
end;//i
for i:=1 to 7 do
begin
edit1.Text:=edit1.Text+inttostr(arr[i]);
end;//i
end;
end.
请问这个冒泡是哪里错了呢??
怎么编译通过了,但是不能运行~~
请各位有时间的话帮我看看………………感激``