您的位置:首页 > 移动开发 > IOS开发

第十六周实验报告4

2012-06-06 13:14 274 查看
【任务4】文档的自动处理

 

#include <iostream>
#include <fstream>
//#include <string>
using namespace std;
int main()
{
ifstream readfile;
ofstream writefile;
char ch[100];
int i;
readfile.open("WolfSheep.nls", ios::in);
writefile.open("WS_nocomment.nls", ios::out);
while (!readfile.eof())
{
readfile.getline(ch,100,'\n');
i = 0;
while(ch[i] != '\0' && ch[i] != ';')
{
writefile.put(ch[i]);
i = i + 1;
}
writefile.put('\n');

}
readfile.close();
writefile.close();
cout << "Finish!" << endl;
system("pause");
return 0;
}






以前没发现,“fstream”里面还有这么多的函数,可以直接用,太方便了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ios system 文档 任务