利用冒泡排序法将下面10个整数从大到小进行排序并打印出来:

2025-01-06 09:59:54
推荐回答(1个)
回答1:

冒泡排序Pascal代码
program aa;
var
s,r:array[1..100] of integer;
a,b,c,max,d,e,f,g,h,i,j,k,l,m,n:integer;
begin
max:=0;
for i:=1 to 10 do
read(r[i]);
for i:=10 downto 2 do
for a:=1 to i-1 do
if r[a]begin
max:=r[a];
r[a]:=r[a+1];
r[a+1]:=max;
end;
for i:=1 to 10 do
writeln(r[i]);
end.