|
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: 1024 (0x400) Types: TextFile Names: »TERNING2.PAS«
└─⟦08ea08c61⟧ Bits:30003924 PolyPascal programmer └─ ⟦this⟧ »TERNING2.PAS«
PROGRAM terning2; (* Kast med to terninger. Hyppighedsfordeling for summen *) TYPE oejesum = 2 .. 12; oejehyppighed = ARRAY(.oejesum.) OF INTEGER; VAR sum : oejesum; hyppighed : oejehyppighed; kast1, kast2, i, antal : INTEGER; BEGIN RANDOMIZE; WRITE(CLRHOM, 'Indtast antal kast: '); READLN(antal); FOR sum := 2 TO 12 DO hyppighed(.sum.) := 0; FOR i := 1 TO antal DO BEGIN kast1 := RANDOM(6) + 1; kast2 := RANDOM(6) + 1; sum := kast1 + kast2; hyppighed(.sum.) := hyppighed(.sum.) + 1; END; WRITELN; WRITELN('SUM HYPPIGHED'); FOR sum := 2 TO 12 DO WRITELN(sum : 2, hyppighed(.sum.) : 11); END. «eof»