shadanji
全部博文(40)
Python(6)
C/C++(0)
K&R2(4)
C语言程序(0)
边角旮旯(1)
厨艺(0)
操作系统设计与实(6)
2011年(8)
2010年(32)
get109en
Angel_Si
jackyguo
lidanyan
xiaobaih
ChangeFu
bclzvs
heart201
xtwyp
分类: C/C++
2010-05-08 12:13:04
/* * The program output the statement with one word a line. * * zj * 2010-5-8 */ #include <stdio.h> #include <memory.h> #define WORDLEN 10 int main(){ int c, offset = 0; char word[WORDLEN]; memset(word, 0x0, WORDLEN); while((c = getchar()) != EOF){ if(c == ' ' || c =='\n' || c == '\t'){ word[offset] = '\0'; puts(word); offset = 0; memset(word, 0x0, WORDLEN); } else{ word[offset++] = c; } } return 0; }
#include <stdio.h> int main(){ int c; while((c = getchar()) != EOF){ if(c == ' ' || c == '\n' || c == '\t'){ putchar('\n'); } else{ putchar(c); } } return 0; }
上一篇:1_10
下一篇:第2章 进程-1
登录 注册