|
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: 1280 (0x500) Types: TextFile Names: »SOEG.PAS«
└─⟦09235ab48⟧ Bits:30003065 Demoprogrammer K-Z til Pascal bog └─ ⟦this⟧ »SOEG.PAS« └─⟦092727b26⟧ Bits:30005927 Demoprogrammer til Pascal bog (Jet-80) └─ ⟦this⟧ »SOEG.PAS«
PROGRAM soeg; (* SEARCH *) (* Programmet undersøger, om et givet *) (* tal findes i en vektor af tal *) CONST antal = 200; TYPE vektor = ARRAY(.1 .. antal.) OF INTEGER; VAR v : vektor; i, tal, nr : INTEGER; fundet : BOOLEAN; BEGIN RANDOMIZE; WRITE(CHR(12),'Vi fabrikerer en vektor:'); WRITELN; FOR i := 1 TO antal DO v(.i.) := RANDOM(1000); FOR i := 1 TO antal DO WRITE(v(.i.):4); WRITELN; WRITE('Tast det givne tal: '); READLN(tal); WRITELN; fundet := FALSE; i := 0; REPEAT i := i + 1; IF tal = v(.i.) THEN BEGIN nr := i; fundet := TRUE; END; UNTIL (i = antal) OR fundet; IF fundet THEN WRITELN(tal, ' står som nr. ', nr, ' i vektoren') ELSE WRITELN(tal, ' findes ikke blandt tallene i vektoren'); END. «eof»