How do i make it so when the program is restarted and new data is inputted the data appends to the file instead of overwriting it?
You'll need to use the optional second parameter to your ofstream constructor to alter the default behavior of truncating the file when opening. Something like: std::ofstream("YourFile", std::ios::app);