I have a program that reads a list of assignments and removes the "bad" assignments, then writes into a new file. My function that removes the bad assignments works correctly. The code I currently am using to read the text file works correctly also, but is doing so with a while loop. How can I utilize the std::list library to accomplish the same thing without the while loop? Below is the code I am using for the removing of the bad assignments (Prune) along with reading the text file.
Why so complicated?
Just read the assignments one by one and if it is not bad write to the output file.
No point in storing them in a list if you don't do anything else with them.
and to answer Thomas1965's question, I had to do it this way for the assignment. I originally did it the easier way you mentioned but have to use a list.