|
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 - download
Length: 1536 (0x600) Types: TextFile Names: »REALSORT.PAS«
└─⟦692ac107c⟧ Bits:30005923 PolyPascal-80 V3.10 arbejdsdiskette 1 └─ ⟦this⟧ »REALSORT.PAS«
PROGRAM bubble3; (* Programmet sorterer en række tal ved bubblesort-metoden *) (* Bubblesort med flag *) (* Udskriften kommer på skærmen *) TYPE vektor = ARRAY(.1..100.) OF REAL; VAR v : vektor; j,i : integer; ii,byt : real; slut : BOOLEAN; talfil :file of real; BEGIN assign (talfil,'b:talreal.dat'); reset (talfil); WRITE(CLRHOM,'De usorterede tal er '); WRITELN; i:=1; while not eof(talfil) do BEGIN read(talfil,ii); WRITE(ii :15:6,' '); vÆiÅ := ii; i :=succ(i); END; REPEAT slut := TRUE; FOR j := 1 TO length(talfil) DO IF vÆjÅ > vÆj +1Å THEN BEGIN slut := FALSE; byt := v(.j.); v(.j.) := v(.j + 1.); v(.j + 1.) := byt; END; UNTIL (i = 1) OR slut; WRITELN; WRITELN('De sorterede tal er:'); FOR i := 1 TO length(talfil) DO æ WRITE(lst,v(.i.) : 4:6,' ');å WRITE(vÆiÅ:15:6,' '); WRITELN; close(talfil); END. «eof»