| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
共有 835 人关注过本帖
标题:请教各位EOF是什么该怎么用
取消只看楼主 加入收藏
duansheng00
Rank: 1
等 级:新手上路
帖 子:5
专家分:2
注 册:2012-1-24
结帖率:0
收藏
 问题点数:0 回复次数:2 
请教各位EOF是什么该怎么用
#include <stdio.h>

int main()
{
    long nc;
 
    nc = 0;
    while(getchar() != EOF)

        ++nc;
    printf("%ld", nc);
    return 0;
}

此程序有什么作用,其中EOF有什么作用。
.Write a program to print the same string if it encounter that it had reached to the end of the string .for example  if  string is “I am a student”  it should print the same string on reaching the end of the given string { hint use EOF getchar ,putchar keywords.这是我们作业,不知道该怎么用EOF,请各位指点。
2012-05-03 15:53
duansheng00
Rank: 1
等 级:新手上路
帖 子:5
专家分:2
注 册:2012-1-24
收藏
得分:0 
回复 2楼 zspsspsp
不是什么作业贴,只是不懂什么是EOF,怎么用EOF判断一个字符串是怎么结束。
2012-05-03 16:06
duansheng00
Rank: 1
等 级:新手上路
帖 子:5
专家分:2
注 册:2012-1-24
收藏
得分:0 
百度文库是有说ctrl+z但是没看懂什么意思,运行之后只能输入一组数据,改成\n可以运行,但是还是不理解eof的用法......
2012-05-04 01:22
快速回复:请教各位EOF是什么该怎么用
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014238 second(s), 8 queries.
Copyright©2004-2025, BC-CN.NET, All Rights Reserved