首页 > 其他 > 详细

自考新教材-p326_3(1)

时间:2020-02-05 18:34:52      阅读:61      评论:0      收藏:0      [点我收藏+]

源程序:

#include <iostream>
#include <fstream>
using namespace std;

int main()
{
int i;
ofstream ftxt1;
ftxt1.open("c:\\tmp\\xt1.txt",ios::out);
for (i = 1; i < 10; i++)
ftxt1 << i << ‘ ‘;
ftxt1.close();
ifstream ftxt2;
ftxt2.open("c:\\tmp\\xt1.txt",ios::in);
while (!ftxt2.eof())
{
ftxt2 >> i >> i;
cout << i << endl;
}
ftxt2.close();
system("pause");
return 1;

}

运行结果:

文件xt1.txt的内容如下:

技术分享图片

 

 屏幕显示结果如下:

技术分享图片

 

自考新教材-p326_3(1)

原文:https://www.cnblogs.com/duanqibo/p/12264598.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!