問題及代碼:
/*copyright(c)2016.煙台大學計算機學院
* All rights reserved,
* 檔案名稱:text.Cpp
* 作者:李一波
* 完成日期:2016年6月19日
* 版本号:codeblocks
*
* 問題描述:
* 輸入描述:
* 程式輸出:
*/
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream readFile;
ofstream writeFile;
char ch;
readFile.open("a.txt", ios::in);
writeFile.open("b.txt", ios::out);
while (readFile.get(ch))
writeFile.put(ch);
readFile.close();
writeFile.close();
cout << "Finish!" << endl;
return 0;
}
運作結果:
![](https://img.laitimes.com/img/_0nNw4CM6IyYiwiM6ICdiwiIyVGduV2QvwVe0lmdhJ3ZvwFM38CXlZHbvN3cpR2Lc1TPB10QGtWUCpEMJ9CXsxWam9CXwADNvwVZ6l2c052bm9CXUJDT1wkNhVzLcRnbvZ2LcZXUYpVd1kmYr50MZV3YyI2cKJDT29GRjBjUIF2LcRHelR3LcJzLctmch1mclRXY39TMyQDNyQzMxETOxYDM2EDMy8CX0Vmbu4GZzNmLn9Gbi1yZtl2Lc9CX6MHc0RHaiojIsJye.jpg)