您的位置:首页 > 其它

练习1-12

2004-09-07 18:37 162 查看
练习1-12 编写一个程序,以每行一个单词的形式打印其输入

#include <stdio.h>

#define IN 1

#define OUT 0

int main(void)

{     int stats=0,a;

     while( (a=getchar()) !=EOF){

             if(stats ==IN &&(a==' '||a=='/t'||a=='/n')){

                  stats=OUT; putchar('/n'); continue;

             }

           else if(a!=' ' &&a!='/t' &&a!='/n'){

                   putchar(a);  stats=IN;

             }

   }/*end while*/

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: