Originally posted by Wolkec
Refer this link
You will get an idea of how to do this..!
Regards
(from http://www.cplusplus.com/doc/tutorial/files.html) // reading a text file #include <iostream> #include <fstream> #include <string> using namespace std; int main () { string line; ifstream myfile ("example.txt"); if (myfile.is_open()) { while (! myfile.eof() ) { getline (myfile,line); /*here you can compare : line == "user" than take health and energy and apply logic accordingly*/ cout << line << endl; } myfile.close(); } else cout << "Unable to open file"; return 0; }
Comment