home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / qc_prog / chap13 / getchar.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-04-07  |  291 b   |  13 lines

  1. /*      getchar.c -- using getchar()         */
  2.  
  3. #include <stdio.h>
  4. main()
  5. {
  6.     int count = 1;
  7.  
  8.     printf("Please enter a word.\n");
  9.     while (getchar() != '\n')       /* here it is */
  10.         printf("%d.. ", count++);
  11.     printf("\n%d characters altogether\n", count - 1);
  12. }
  13.