home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / PASCAL / PT03.ZIP / LINECNT.AR < prev    next >
Encoding:
Text File  |  1983-09-02  |  680 b   |  36 lines

  1. -h- linecnt.cmd 227
  2. { linecount -- count lines in standard input }
  3. procedure linecount;
  4. var
  5.  nl : integer;
  6.  c : character;
  7. begin
  8.  nl := 0;
  9.  while (getc(c) <> ENDFILE) do
  10.   if (c = NEWLINE) then
  11.    nl := nl + 1;
  12.  putdec(nl, 1);
  13.  putc(NEWLINE)
  14. end;
  15. -h- linecnt.pas 296
  16. {$debug-}
  17. program outer (input,output);
  18.  
  19. {$include:'globcons.inc'}
  20. {$include:'globtyps.inc'}
  21.  
  22. {$include:'initio.dcl'}
  23. {$include:'getc.dcl'  }
  24. {$include:'putc.dcl'  }
  25. {$include:'putdec.dcl'}
  26. {$include:'flush.dcl' }
  27.  
  28. {$include:'linecnt.cmd' }
  29. BEGIN
  30.   minitio; initio;
  31.   linecount;
  32.   flush(0);
  33. END.
  34. -h- linecnt.mak 62
  35. linecnt+initio+getc+putc+putdec+itoc+getfcb+error+putcf+flush
  36.