第十六周实验报告4
2012-06-06 13:14
274 查看
【任务4】文档的自动处理
以前没发现,“fstream”里面还有这么多的函数,可以直接用,太方便了
#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”里面还有这么多的函数,可以直接用,太方便了
相关文章推荐
- C++程序设计实验报告(八十)---第十六周任务二
- 第十六周实验报告3
- 《C++第十六周实验报告1-1》---涨工资
- 第十六周实验报告(任务一)【涨工资】
- 《第十六周实验报告任务2——学生成绩排序》
- 第十六周实验报告一
- C++程序设计实验报告(八十一)---第十六周任务三
- 第十六周实验报告2
- 第十六周实验报告1
- 20162317袁逸灏 第十六周实验报告:实验五 网络编程与安全
- 《C++第十六周实验报告2-1》---学生成绩排序
- 第十六周实验报告2
- 第十六周实验报告2
- C++程序设计实验报告(八十二)---第十六周任务#3-2(学会二分查找)
- 第十六周实验报告二
- 第十六周实验报告1
- 第十六周实验报告1
- 《C++第十六周实验报告3-1》---电子词典
- 第十六周实验报告任务3--电子词典
- 第十六周实验报告3