P.S. my save part of the code works.
thanks in advance for help
Expand|Select|Wrap|Line Numbers
- ofstream myfile;
- ifstream load_file("Game save.txt");
- string line;
- class BadConversion : public std::runtime_error {
- public:
- BadConversion(const std::string& line)
- : std::runtime_error(line)
- { }
- };
- inline double convertToDouble(const std::string& line)
- {
- std::istringstream i(line);
- double x;
- if (!(i >> x))
- throw BadConversion("convertToDouble(\"" + line + "\")");
- return x;
- }
- if(load_file.is_open())
- {
- while(! load_file.eof())
- {
- getline (load_file,line);
- money = convertToDouble(line);
- //cout<<"Here is your previous game winnings: ";
- //cout << money << "\n";
- //Sleep(3000);
- }
- load_file.close();
- }