So I have an assignment to write a program that reads from a text file, manipulates the data, then inserts the manipulated data into an output file. The program works fine if I only have to run the program once. However, the program needs to loop through the input file and run multiple times until the programs receives input of all O's from the "input.txt" file. Below I have provided what I currently have for the program, which is NOT running correctly. If I remove the do loop within the main function, the program will work correctly, but will only run itself once. Below my program, I will include the sample text file provided by my instructor. I am definitely not asking for anyone to re-do my project, but if you could please steer me in the correct direction, it would be appreciated.
One suggestion is to open both input and output files in main(). Pass these by reference as parameters to the functions as required.
In particular the ReadInputRecord() function. You might have this return a bool value true if everything went well, and return false if there was a read error or the values were zeroes.
I show the logic for main() here. The other functions I will leave for you to complete. Note the changed parameter list and that the read function must always return a value. (There is no need to call exit() as the main() function controls the logic for terminating the program).