뭐가 문제인지 모르겠습니다..

Woojaeik Reply 7 years 8 weeks ago
#include <stdio.h> #define WORD 1 #define NOTWORD 0 int main() { int c, state; state = 1; while ((c = getchar()) != EOF) { if (state == 1) { if (c != ' ') { putchar(c); state = 1; } else if (c == ' ') { putchar(' '); state = 0; } } else if (state == 0) { if (c == ' ') { state = 0; } } else if (c != ' ') { putchar(c); state = 1; } } return 0; } 공백이후의 문자에 대한 putchar값이 나오지 않습니다ㅠㅠ 어디가 잘못된걸까요ㅠㅠ
withcs1 Reply 7 years 8 weeks ago
세번째 else if문 잘못빼신거같네요