请编写函数,从文件中读出文章,将其输出到屏幕上。

函数原型

void ReadArticle(FILE *f);

说明:参数 f 为文件指针。函数读出 f 所指示文件中的文章,将其输出到屏幕上。

裁判程序

#include <stdio.h>
#include <stdlib.h>void ReadArticle(FILE *f);int main()
{FILE *f;f = fopen("Article.txt", "r");if (!f){puts("文件无法打开!");exit(1);}ReadArticle(f);if (fclose(f)){puts("文件无法关闭!");exit(1);}return 0;
}/* 你提交的代码将被嵌在这里 */

打开 Windows 的记事本软件,复制下面的文字内容,保存文件并命名为“Article.txt”。

Article.txt

A Cure for a HeadacheOne day a man went into a chemist's shop and said, "Have you anything to cure a
headache?"
The chemist took a bottle from a shelf,  held it under the gentleman's nose and
took out the cork.  The smell was so strong that tears came into the man's eyes
and ran down his cheeks.
"What did you do that for?"  he said angrily,  as soon as he could get back his
breath.
"But that medicine has cured your headache, hasn't it?" said the chemist.
"You fool," said the man, "It's my wife that has the headache, not me!"

输入样例

(无)

输出样例

A Cure for a HeadacheOne day a man went into a chemist's shop and said, "Have you anything to cure a
headache?"
The chemist took a bottle from a shelf,  held it under the gentleman's nose and
took out the cork.  The smell was so strong that tears came into the man's eyes
and ran down his cheeks.
"What did you do that for?"  he said angrily,  as soon as he could get back his
breath.
"But that medicine has cured your headache, hasn't it?" said the chemist.
"You fool," said the man, "It's my wife that has the headache, not me!"

示例;

void ReadArticle(FILE *f)
{char  ch;ch=fgetc(f);while (ch != -1){printf("%c",ch);ch=fgetc(f);}
}

6-1 读文章(*)相关推荐

  1. 读文章笔记(八):多模态情感分析数据集整理

    读文章笔记(八):多模态情感分析数据集(Multimodal Dataset)整理 双模态(一般是文本.图像和语音的两两组合) 三模态(一般是文本.图像加语音) 作者:骑着白马的王子 地址:https ...

  2. 读文章笔记-自适应和加速GB生成算法

    读文章笔记-GBC 文章 背景 内容 定义1+现有GB生成过程 GBKNN 文章的GB生成算法 疑问与反思 文献脉络 文章 An Efficient and Adaptive Granular-Bal ...

  3. PTA--文件--函数题--读文章--C语言

    ** 6-3 读文章* (10 分) ** 请编写函数,从文件中读出文章显示到屏幕上. 函数原型 void ReadArticle(FILE *f); 说明:参数 f 为文件指针.函数读出 f 所指示 ...

  4. 读文章笔记(三):从源码学习Transformer

    读文章笔记(三):从源码学习Transformer encoder分为两部分: decoder 公众号机器学习算法工程师 文章链接: https://mp.weixin.qq.com/s/0NajB_ ...

  5. 读文章笔记(十):多任务学习

    读文章笔记(十):多任务学习 多任务学习优点 多任务学习方法 hard parameter sharing soft parameter sharing 多任务学习改进的方向 注意事项 来源于公众号: ...

  6. 读文章笔记(十一):对比学习(Contrastive Learning)

    读文章笔记(十一):对比学习(Contrastive Learning) 对比学习 来源于:对比学习(Contrastive Learning):研究进展精要 对比学习 对比学习属于无监督或者自监督学 ...

  7. 读文章笔记(十三):多模态特征融合方法总结

    读文章笔记(十三):多模态特征融合方法总结 来源于:多模态特征融合方法总结 多模态特征融合的方法大体分为三种:前端融合.中间融合和后端融合.

  8. 读文章笔记(二):模型结构优化前沿动态综述

    读文章笔记(二):模型结构优化前沿动态综述 公众号东大自然语言处理实验室文章链接: link. NLP领域神经网络结构的发展历程: 相关模型总结分析,NLP领域模型结构的整体趋势 神经网络模型结构优化 ...

  9. 读文章笔记(七):赛尔笔记 | 多模态情感分析简述

    读文章笔记(七):多模态情感分析简述 相关任务概览 数据集和方法 面向图文的情感分类任务 面向图文的方面级情感分类任务 赛尔笔记 | 多模态情感分析简述 https://zhuanlan.zhihu. ...

  10. 《GAN万字长文综述》的读文章笔记

    我的个人微信公众号:Microstrong 微信公众号ID:MicrostrongAI 公众号介绍:Microstrong(小强)同学主要研究机器学习.深度学习.计算机视觉.智能对话系统相关内容,分享 ...

最新文章

  1. dotproject 文件下载错误
  2. 看代码学知识之(2) ListView无数据时显示其他View
  3. LeetCode 643. Maximum Average Subarray I
  4. php基础自测卷2,php基础2
  5. Python使用pip自动升级所有第三方库
  6. java并发编程 博客_JAVA并发编程常识
  7. C语言求两个数的最大公约数
  8. 遥感、GIS、计算机视频教程
  9. 【Dart语言第5篇】运算符
  10. apple developer苹果账号过期了如何续费
  11. revel MySQL_使用Revel(go)开发网站
  12. 苹果也被撕下遮羞布,iPhone14后继乏力,靠十三香维持销量
  13. Android和风SDK,Android 和风天气SDK获取天气
  14. 学会提问——批判性思维指南
  15. ESP32自动更新气象站
  16. 美国得州大停电是“人祸”,别想让光伏风电背锅!
  17. visa基本函数操作
  18. 这份网络安全入门笔记(共327页),助你步入安全门槛
  19. (R)-tert-Bu4- DOTAGA为一种聚甲酸酯(polymethylene)分子,817562-90-6
  20. 如何让excel表格排头一直都在_Excel表格技巧—凌乱的表格如何快速整理

热门文章

  1. VS创建 Win32 应用程序(实现窗口的创建)
  2. 路由器wan口认证断开服务器无响应,路由器WAN口设置已断开(服务器无响应)的解决方法...
  3. java实现爬虫,爬取网易歌单信息
  4. VIP邮箱发出去的邮件能撤回吗?怎么撤回邮件?
  5. Eclipse插件Target Management (RSE)
  6. vue 实现ps图片编辑_Vue项目图片剪切上传——vue-cropper的使用
  7. 基于Python3的格雷厄姆 股票估值模型
  8. 如何查看tkinter可用的字体有哪些
  9. tyvj1939 玉蟾宫
  10. AlignedReID