Advertisement
lnsee96

Untitled

Aug 3rd, 2016
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Write a program that prints its input one word per line
  2.  
  3. #include <stdio.h>
  4. #define IN 1
  5. #define OUT 0
  6. main()
  7. {
  8.     int c,state;
  9.     state=OUT;
  10.     while ((c=getchar())!=EOF)
  11.     {
  12.         if (c==' '||c=='\n'||c=='\t')
  13.             state=OUT;
  14.         else
  15.         {
  16.             if (state==OUT)
  17.             {
  18.                 printf("\n");
  19.                 state=IN;
  20.             }
  21.         }
  22.             putchar(c);
  23.  
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement