how to use ofstream to put values of the same variables in a file in c++ using function code example
Example 1: file reading c++
int a, b;
ifstream bd;
myfile.open("file.txt");
if (myfile.is_open())
while (bd >> a >> b)
cout << a << b << endl;
else cout << "ERROR";
Example 2: fstream read write mode
stream file;
file.open(fileName,ios::in | ios::out);