back
Appending to a Data File
"Appending" to a file means adding to it. Now you can alter your program so that it will open up a data file and add to it. If you don't append to a file, it wipes it out and starts fresh each time. It's easy to do, you only change one line of code. Change:

outfile.open("data.txt", ios::out);

To:

outfile.open("data.txt", ios::app);

Assignment
Take the program that you wrote in the last assignment and change it so that it appends to the data file.