c++ file stream code example
Example 1: write to file in C++
ofstream myfile;
myfile.open("file.txt");
myfile << "write this to file"
Example 2: file streams in c++
$./a.out
Writing to the file
Enter your name: Zara
Enter your age: 9
Reading from the file
Zara
9