DataMuseum.dk

Presents historical artifacts from the history of:

CP/M

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about CP/M

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦7574ae04e⟧ TextFile

    Length: 1024 (0x400)
    Types: TextFile
    Names: »TERNING2.PAS«

Derivation

└─⟦09235ab48⟧ Bits:30003065 Demoprogrammer K-Z til Pascal bog
    └─ ⟦this⟧ »TERNING2.PAS« 
└─⟦092727b26⟧ Bits:30005927 Demoprogrammer til Pascal bog (Jet-80)
    └─ ⟦this⟧ »TERNING2.PAS« 

TextFile

        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(CHR(12), '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»