//head files
#include<iostream>
#include<fstream>
//open or create a txt file
std::ofstream outfile("file.txt");
//write something
outfile << x << std::endl;
//close the file
outfile.close();
//head files
#include<iostream>
#include<fstream>
//open or create a txt file
std::ofstream outfile("file.txt");
//write something
outfile << x << std::endl;
//close the file
outfile.close();