Inside your
input_file()
function you have the following:
while(inputnums >> total_cents)
{
}
This reads all the numbers from the input file, and does not return until you get to the end-of-file.
What you want to do is more like:
while(inputnums >> total_cents)
{
output_file(total_cents);
}
However, I recommend that you think about what is going on with your program, as written. If you only make the change suggested above, for every input value you are opening and closing the output-file, which is a major inefficiency. Better would be to do somethink like (pseudo code)
open input-file
open output-file
while (read input-file returns a number)
{
write results to output-file
}
close input-file
close output-file