C++实现输出内容存入到TXT文档中
step1:包含头文件
step 2:代码
#include
#include
using namespace std;
int main(){
ofstream outfile;
outfile.open(“data.txt”, ofstream::app);
outfile << “data” << dis_xy[0] << endl;
// 关闭文档
outfile.close();
}
step3:运行结果 :
step1:包含头文件
step 2:代码
#include
#include
using namespace std;
int main(){
ofstream outfile;
outfile.open(“data.txt”, ofstream::app);
outfile << “data” << dis_xy[0] << endl;
// 关闭文档
outfile.close();
}
step3:运行结果 :