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

⟦96e0fe43c⟧ TextFile

    Length: 2176 (0x880)
    Types: TextFile
    Names: »RESULTS.PAS«

Derivation

└─⟦49cd49952⟧ Bits:30009431 50004848
    └─⟦0c326962c⟧ 
        └─⟦this⟧ »RESULTS.PAS« 

TextFile

PROGRAM results (input);

  CONST maxevents = 8;      æmaximum events for one entrantå
        colwidth = 5;       æcolumn width on tabulationå

  TYPE  competitor = 100..999;      ærange of entrants' numberså
        score = 0..100;     æpossible scores for one eventå

  VAR   thiscomp, winner: competitor;
        eventscore: score;  totalscore: integer;
        eventcount: 0..maxevents;
        average, winningav: real;
        listing: text;      æoutput file for tabulationå

  BEGIN
    winningav := 0;
    assign (listing, 'RESULTS.PRN');  rewrite (listing);

        æprocess input and produce listingå
    WHILE NOT eof (input) DO
      BEGIN
           æread competitor numberå
        read (thiscomp);
        write (listing, thiscomp:5, ' ':3);

        eventcount := 0;  totalscore := 0;
           ænow his scores until end-of-lineå
        WHILE NOT eoln (input) DO
          BEGIN
            read (eventscore);
            write (listing, eventscore:colwidth);
            totalscore := totalscore + eventscore;
            eventcount := eventcount + 1;
          END     æof processing one resultå;

            æspace across to totals columnå
        IF eventcount < maxevents THEN
          write (listing, ' ': (maxevents-eventcount)*colwidth);
            æcalculate & print averageå
        IF eventcount = 0 THEN average := 0
        ELSE average := totalscore / eventcount;
        writeln (listing, totalscore:8, average:6:2);
            æis average greater than current winner ?å
        IF (eventcount >= 5) AND (average > winningav) THEN
          BEGIN
            winner := thiscomp;    æbest so farå
            winningav := average;
          END;
        readln ;
      END     æof pocessing one competitorå;

            æat end of input, print winnerå
    writeln (listing);  writeln (listing);   æblank lineså
    IF winningav > 0 THEN
      writeln (listing, '    Winner is number', winner:5,
                        '  with average', winningav:6:2)
    ELSE writeln (listing, '    No entrant qualified as winner');

  END.
«eof»