1#include <fstream>
2
3ifstream file_variable; //ifstream is for input from plain text files
4file_variable.open("input.txt"); //open input.txt
5
6file_variable.close(); //close the file stream
7/*
8Manually closing a stream is only necessary
9if you want to re-use the same stream variable for a different
10file, or want to switch from input to output on the same file.
11*/
12_____________________________________________________
13//You can also use cin if you have tables like so:
14while (cin >> name >> value)// you can also use the file stream instead of this
15{
16 cout << name << value << endl;
17}
18_____________________________________________________
19//ifstream file_variable; //ifstream is for input from plain text files
20ofstream out_file;
21out_file.open("output.txt");
22
23out_file << "Write this scentence in the file" << endl;