pascal问题求输出var a:array[1..6] of integer; i,j,p,t:integer;begin for i:=1 to 6 do read(a[i]); for j:=1 to 6-1 dobeginp:=j;for i:=j to 6 doif a[i]< a[p] then p:=i;t:=a[p];a[p]:=a[j];a[j]:=t;end; for i:=1 to 6 dobeginwrite(a[i]:2);if i
来源:学生作业帮助网 编辑:六六作业网 时间:2025/01/25 12:15:47
pascal问题求输出var a:array[1..6] of integer; i,j,p,t:integer;begin for i:=1 to 6 do read(a[i]); for j:=1 to 6-1 dobeginp:=j;for i:=j to 6 doif a[i]< a[p] then p:=i;t:=a[p];a[p]:=a[j];a[j]:=t;end; for i:=1 to 6 dobeginwrite(a[i]:2);if i
pascal问题求输出
var a:array[1..6] of integer;
i,j,p,t:integer;
begin
for i:=1 to 6 do read(a[i]);
for j:=1 to 6-1 do
begin
p:=j;
for i:=j to 6 do
if a[i]< a[p] then p:=i;
t:=a[p];a[p]:=a[j];a[j]:=t;
end;
for i:=1 to 6 do
begin
write(a[i]:2);
if i mod 3=0 then writeln;
end;
end.
输入:7 2 5 1 9 4
pascal问题求输出var a:array[1..6] of integer; i,j,p,t:integer;begin for i:=1 to 6 do read(a[i]); for j:=1 to 6-1 dobeginp:=j;for i:=j to 6 doif a[i]< a[p] then p:=i;t:=a[p];a[p]:=a[j];a[j]:=t;end; for i:=1 to 6 dobeginwrite(a[i]:2);if i
输入:7 2 5 1 9 4
输出:
1 2 4
5 7 9