c++如何對多個檔案連續讀寫?
例如我要對
0.in
1.in
2.in
3.in
4.in
這5個檔案進行讀寫
一般使用
ifstream cin("0.in")';
ofstream cout("0.out");
重寫5次,有沒有可以寫一個for就可以持續完成對這個5個檔案讀寫?
uj5u.com熱心網友回復:
for(int i=0;i<=4;i++)
{
ifstream cin(String(i)+".in")';
ofstream cout(String(i)+".out");
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/91543.html
標籤:基礎類
上一篇:這是一個約瑟夫環問題的變種
