lolamontes69

K+R Exercise1_10

Sep 5th, 2014
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.82 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     int c;
  6.  
  7.     while((c=getchar()) != EOF) {         // Remember curly braces
  8.        if(c=='\t') {                      // for 'while' loops
  9.            putchar('\\');                
  10.            putchar('t');
  11.        }
  12. /* ************************************************************************ */
  13.        else if(c=='\b') {                 // OS doesn't intercept /b
  14.            putchar('\\');
  15.            putchar('b');
  16.        }
  17. /* *********************************************************************** */
  18.        else if(c=='\\') {
  19.            putchar('\\');                 // putchar() puts one character
  20.            putchar('\\');                 // at a time so do it twice
  21.        }
  22.        else
  23.            putchar(c);
  24.     }
  25.     printf("That was tits.\n");
  26.     return(0);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment