lolamontes69

K+R Exercise1_12

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