Advertisement
feblehober123

le

Oct 9th, 2014
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.31 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. /* le:  output every line of input prefixed with "le" */
  4. int main()
  5. {
  6.     int c;
  7.     int d = 0;
  8.  
  9.     printf("le ");
  10.     while ((c = getchar()) != EOF) {
  11.         putchar(c);
  12.         if (c == '\n' && (d = getchar()) != EOF)
  13.             printf("le ");
  14.         if (d) {
  15.             ungetc(d, stdin);
  16.             d = 0;
  17.         }
  18.     }
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement