将输入每行一个字词打印

#include <stdio.h>

int main(void){
    int c = 0, linestarted = 0;
    printf(Input some characters, then press Ctrl+D.\n);

    while ((c = getchar()) != EOF)
        if (c == ' ' || c == '\t' || c == '\n') {
            if (!linestarted) {
                putchar('\n');
                linestarted = 1;
            }
        } else {
            putchar(c);
            linestarted = 0;
        }

    return 0;
}

相关文章

for遍历数组
。。。
声明一个计数循环
咕咕咕
#include <stdio.h> int main (void) { printf (&quo...