0
点赞
收藏
分享

微信扫一扫

第十六周 阅读程序3


/*
*Copyright(c) 2016,烟台大学计算机学院
*作 者:刘金石
*版本号:coadblocks
*完成日期:2016年6月17日
*问题描述:阅读程序2
*/
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
int main()
{
ifstream readFile;
ofstream writeFile;
char ch[100];
readFile.open("a.txt", ios::in);
writeFile.open("b.txt", ios::out);
while (!readFile.eof())
{
readFile.getline(ch,100,'\n');
writeFile.write(ch,strlen(ch));
writeFile.write("\n",1);
}
readFile.close();
writeFile.close();
cout << "Finish!" << endl;
return 0;
}
//此程序的功能是把a.txt中的内容复制到b.txt中,

运行结果:

第十六周 阅读程序3_IO

第十六周 阅读程序3_ofstream_02

第十六周 阅读程序3_ios_03


举报

相关推荐

0 条评论