home *** CD-ROM | disk | FTP | other *** search
/ Between Heaven & Hell 2 / BetweenHeavenHell.cdr / 100 / 90 / ctutor2b.arc / BETTERIN.C < prev    next >
C/C++ Source or Header  |  1987-11-21  |  609b  |  21 lines

  1.                                         /* Chapter 9 - Program 3 */
  2. #include "stdio.h"
  3. #define CR 13       /* this defines CR to be 13 */
  4. #define LF 10       /* this defines LF to be 10 */
  5.  
  6. main()
  7. {
  8. char c;
  9.  
  10.    printf("Input any characters, hit X to stop.\n");
  11.  
  12.    do {
  13.       c = getch();                    /* get a character */
  14.       putchar(c);                     /* display the hit key */
  15.       if (c == CR) putchar(LF);       /* if it is a carriage return
  16.                                          put out a linefeed too */
  17.    } while (c != 'X');
  18.  
  19.    printf("\nEnd of program.\n");
  20. }
  21.