#include<iostream>
#include<fstream>
using namespace std;
int main() {
char c[10];
fstream infile1("196A.txt", ios::in);
fstream infile2("196B.txt", ios::in);
fstream infile3("196C.txt", ios::in);
fstream outfile("196C.txt", ios::out);
while (!infile1.eof()) {
infile1.getline(c, 10);
outfile << c << endl;
}
while (!infile2.eof()) {
infile2.getline(c, 10);
outfile << c << endl;
}
//將196C.txt的內容輸出到螢屏上
while (infile3 >> c)
cout << c;
infile1.close();
infile2.close();
outfile.close();
return 0;
}


uj5u.com熱心網友回復:
A, B寫到C后先close A,B,C 然后再打開一次C為讀模式,然后再輸出。uj5u.com熱心網友回復:
#include<iostream>
#include<fstream>
using namespace std;
int main() {
char c[10];
fstream infile1("196A.txt", ios::in);
fstream infile2("196B.txt", ios::in);
fstream outfile("196C.txt", ios::out);
while (!infile1.eof()) {
infile1.getline(c, 10);
outfile << c << endl;
}
while (!infile2.eof()) {
infile2.getline(c, 10);
outfile << c << endl;
}
infile1.close();
infile2.close();
outfile.close();
//將196C.txt的內容輸出到螢屏上
/*infile3 >> c;
while (!infile3.eof()) {
cout << c;
infile3 >> c;
}*/
fstream infile3("196C.txt", ios::in);
while (infile3 >> c)
cout << c;
infile3.close();
return 0;
}
您好,請問是這樣嘛。。
uj5u.com熱心網友回復:
頂一頂,還有大佬嘛
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/91626.html
標籤:C++ 語言
上一篇:求大佬指導一下c語言小程式!
下一篇:matlab非線性最小二乘法,做電池引數辯識的,Idata是電流脈沖,Vdata是電壓回應,tdata是時間,這三個引數已知,出問題了,新手很懵逼
