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

⟦6b22462b2⟧ TextFile

    Length: 1280 (0x500)
    Types: TextFile
    Names: »MAXIMUM2.PAS«

Derivation

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

TextFile

        PROGRAM  maximum2;
        
        (* Programmet finder maximum blandt en række tal *)
        (* Udskriften kommer på printeren                *)
        
        CONST
          antal = 200;
        
        TYPE
          vektor = ARRAY(.1 .. antal.) OF INTEGER;
        
        VAR
          v : vektor;
          i, nr, max : INTEGER;
        
        BEGIN
          RANDOMIZE;
          WRITELN(LST,CHR(12), 'Først vælger vi nogle tal:');
          FOR i := 1 TO antal DO
            v(.i.) := RANDOM(500);
          WRITELN(LST);
          FOR i := 1 TO antal DO   (* Tallene udskrives *)
            BEGIN
              WRITE(LST,v(.i.):4);
              IF i MOD 20 = 0
                THEN WRITELN(LST);
            END;
          WRITELN(LST);
          max := v(.1.);
          nr := 1;
          FOR i := 2 TO antal DO
              IF v(.i.) > max
                THEN
                  BEGIN
                    max := v(.i.);
                    nr := i;       (* Vi noterer, hvor max står *)
                  END;
          WRITELN(LST,'Det største tal er ', max, ' og det står som nr. ',
                  nr, ' i ovenstående række');
        END.
«eof»