|
|
DataMuseum.dkPresents historical artifacts from the history of: CP/M |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about CP/M Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 512 (0x200)
Types: TextFile
Names: »BUBBLE2.PAS«
└─⟦2a24d2e1b⟧ Bits:30003042 Programmer fra Aarhus kursus
└─⟦this⟧ »BUBBLE2.PAS«
program bubblesort;
var i,j : integer;
change : boolean;
s : string(.255.);
procedure byt(a,b :integer);
var ch : char;
begin
write(s(.a.):3,s(.b.):3,' ');
ch:=s(.a.);
s(.a.):=s(.b.);
s(.b.):=ch;
change:=true;
writeln(s);
end;
begin
readln(s);
j:=len(s);
repeat
change:=false;
j:=j-1;
for i:=1 to j do
if s(.i.)<s(.i+1.) then
byt(i,i+1);
until not change;
writeln(s);
end.«eof»