I am trying to write up a code that ask a user for how many numbers will be inputted. Then take that many numbers and save them to a .txt file and repeat, saving the next set of numbers in the next line of the .txt file, until a user inputs -1. The code will compile and run fine the problem is that it will only save the first set of numbers from the user. Can anybody tell me what is causing this?
Open the output file outside of the do loop. When you open it multiple times you reset the stream pointer back to the start, so you are overwriting the previous values.