I'm supposed to write a code that reads data from a file, "fines.dat", then output data which has fines exceeding 500 to a file, "Topfines.dat". The problem it only otuputs the the last fine. Here's my code:
You havent given the format of the data in the "fines.dat" file, but the code that appears to be missing is reading the data from infile.
You need to add this just before the while(infile) and also as the last lines in the while loop.