home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / PASCAL / PT03.ZIP / WORDCNT.AR < prev   
Encoding:
Text File  |  1983-09-06  |  829 b   |  42 lines

  1. -h- wordcnt.cmd 370
  2. { wordcount -- count words in standard input }
  3. procedure wordcount;
  4. var
  5.  nw : integer;
  6.  c : character;
  7.  inword : boolean;
  8. begin
  9.  nw := 0;
  10.  inword := false;
  11.  while (getc(c) <> ENDFILE) do
  12.   if (c = BLANK) or (c = NEWLINE) or (c = TAB) then
  13.    inword := false
  14.   else if (not inword) then begin
  15.    inword := true;
  16.    nw := nw + 1
  17.   end;
  18.  putdec(nw, 1);
  19.  putc(NEWLINE)
  20. end;
  21. -h- wordcnt.pas 296
  22. {$debug-}
  23. program outer (input,output);
  24.  
  25. {$include:'globcons.inc'}
  26. {$include:'globtyps.inc'}
  27.  
  28. {$include:'initio.dcl'}
  29. {$include:'getc.dcl'  }
  30. {$include:'putc.dcl'  }
  31. {$include:'putdec.dcl'}
  32. {$include:'flush.dcl' }
  33.  
  34. {$include:'wordcnt.cmd' }
  35. BEGIN
  36.   minitio; initio;
  37.   wordcount;
  38.   flush(0);
  39. END.
  40. -h- wordcnt.mak 62
  41. wordcnt+initio+getc+putc+putdec+itoc+getfcb+error+putcf+flush
  42.