首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

EOF到底是什么?解决方法

2012-03-31 
EOF到底是什么?#includestdio.h#includestdlib.hintmain(){intc,nb,nt,n1nb0nt0n10while((cge

EOF到底是什么?
#include   <stdio.h>
#include   <stdlib.h>
int   main()
{
      int   c,nb,nt,n1;
      nb=0;
      nt=0;
      n1=0;
      while   ((c=getchar())!=EOF)
                  {
                                                          if   (c== '   ')
                                                              ++nb;
                                                          if   (c== '\t ')
                                                                ++nt;
                                                          if   (c== '\n ')
                                                                ++n1;
                                                                }
      printf   ( "%d%d%d\n ",nb,nt,n1);
        system   ( "PAUSE ");
        return   0;
}
一直没真正理解EOF到底是什么,这以上这个程序中输入什么能让他统计出结果?


[解决办法]
怎样定义文件结束标志?以上程序运行后,一直要求输入字符,怎样才能得到结果呢?指点下!
不是要输入-1才能停下来吧!
————————————————————————————————————————
ctrl+z

热点排行