Advertisement
Guest User

Untitled

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