Line 36 declares ofstream file; u don't u rly shouldn't keep declaring it in each member function...
On line 144 u want to do something like this: file.open("stats.txt");
Then line 119 u have to close that file. This is true for each of those member functions or else u'll get some weird collisions with the stream still being open.
There's also file.open("stats.txt", ios::app); that u may need as it will allow u to open a file with existing text so that u can add more text to it without erasing everything by default.
Lines 26-28 don't rly do anything because 'file' is not open for writing yet.