#include<iostream>
#include<fstream>
using namespace std;
int main() {
ifstream in("try.txt");
int a[4];
for (int i = 0; i < 4; i++) {
in >> a[i]; //读入文件
}
for (int i = 0; i < 4; i++) {
cout << a[i]<<"== "; //输出屏幕
}
ofstream out("output.txt",ios::ate);
for (int i = 0; i < 4; i++) {
out << a[i]<<" "; //写入到文件
}
in.close(); //关闭文件
out.close();
// cout << "hello world!";
return 0;
}
C++简单文件输入输出
最新推荐文章于 2024-02-20 15:27:44 发布