|
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: »NAVNSORT.PAS«
└─⟦08ea08c61⟧ Bits:30003924 PolyPascal programmer └─ ⟦this⟧ »NAVNSORT.PAS« └─⟦09235ab48⟧ Bits:30003065 Demoprogrammer K-Z til Pascal bog └─ ⟦this⟧ »NAVNSORT.PAS« └─⟦092727b26⟧ Bits:30005927 Demoprogrammer til Pascal bog (Jet-80) └─ ⟦this⟧ »NAVNSORT.PAS« └─⟦f983c2ef3⟧ Bits:30004681 Pascal opgaver (Butler) └─ ⟦this⟧ »NAVNSORT.PAS«
PROGRAM navnsort; CONST antal = 10; maxtegn = 30; TYPE streng = STRING(.maxtegn.); arr = ARRAY(.1 .. antal.) OF streng; VAR tabel : arr; PROCEDURE ind(VAR tab : arr); VAR i : INTEGER; BEGIN (* ind *) WRITE(CLRHOM); WRITELN('Indtast ', antal, ' navne:'); WRITELN; FOR i := 1 TO antal DO BEGIN WRITE('Navn nr. ', i : 3, ': '); BUFLEN := maxtegn; READLN(tab(.i.)); END; END; (* ind *) PROCEDURE ud(tab : arr); VAR i : INTEGER; BEGIN (* ud *) WRITELN; WRITELN('Navnene i alfabetisk rækkefølge:'); WRITELN; FOR i := 1 TO antal DO WRITELN(i : 3, ' ', tab(.i.)); END; (* ud *) PROCEDURE sortering(VAR t : arr); VAR i, j : INTEGER; navn : streng; slut : BOOLEAN; BEGIN (* sortering *) i := antal; REPEAT i := i - 1; slut := TRUE; FOR j := 1 TO i DO IF t(.j.) > t(.j + 1.) THEN BEGIN slut := FALSE; navn := t(.j.); t(.j.) := t(.j + 1.); t(.j + 1.) := navn; END; UNTIL (i = 1) OR slut; END; (* sortering *) BEGIN (* navnsort *) ind(tabel); sortering(tabel); ud(tabel); END. (* navnsort *) «eof»