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 - metrics - download

⟦f4d4da0b9⟧ TextFile

    Length: 1408 (0x580)
    Types: TextFile
    Names: »NYGAARD.PAS«

Derivation

└─⟦f983c2ef3⟧ Bits:30004681 Pascal opgaver (Butler)
    └─⟦this⟧ »NYGAARD.PAS« 

TextFile

PROGRAM nygaard;

  VAR
    asekvens, bsekvens, asejr, bsejr, antal : INTEGER;
    i, p, q, r, s, sum : INTEGER;
    afgjort : BOOLEAN;
  
  BEGIN
    WRITE(CLRHOM);
    WRITE('Tast A''s vindersekvens (f.eks. 1011): '); READLN(asekvens);
    WRITE('Tast B''s vindersekvens              : '); READLN(bsekvens);
    WRITE('Tast antal spil                     : '); READLN(antal);
    RANDOMIZE;
    asejr := 0;
    bsejr := 0;
    FOR i := 1 TO antal DO
      BEGIN
        q := RANDOM(2);
        r := RANDOM(2);
        s := RANDOM(2);
        REPEAT
          afgjort := FALSE;
          p := q;
          q := r;
          r := s;
          s := RANDOM(2);
          sum := p * 1000 + q * 100 + r * 10 + s;
          IF sum = asekvens
            THEN
              BEGIN
                asejr := asejr + 1;
                afgjort := TRUE;
                WRITE('A ');
              END;
          IF sum = bsekvens
            THEN
              BEGIN
                bsejr := bsejr    naesteord : ordtype;
            filnavn : STRING(.14.);
            indfil : TEXT;
          
          PROCEDURE laesord(VAR streng : ordtype);
          
            VAR
              taeller : 0 .. maxordlaengde;
              ch : CHAR;
            
            FUNCTION smaabogstaver(streng : ordtype) : ordtype;
            
              VAR
                t