taking input in c++ from file code example
Example 1: how to load from files C++
// basic file operations
#include <iostream>
#include <fstream>
using namespace std;
int main () {
ofstream myfile;
myfile.open ("example.txt");
myfile << "Writing this to a file.\n";
myfile.close();
return 0;
}
Example 2: fstream read write mode
stream file;
file.open(fileName,ios::in | ios::out);