fstream

This is a discussion on fstream within the C++ Programming forums, part of the General Programming Boards category; I have just learned how to use fstream in my programming class and we are supposed to gather the information ...

fstream

I have just learned how to use fstream in my programming class and we are supposed to gather the information from a file we have created which I have named Section51.dat
The program is supposed to find the largest integer in the file. There is something wrong with my while loop and I can't work it out in my head. It keeps telling me the number of integers in the file instead of telling me the LARGEST integer in the file. Can someone show me how to design this loop in the correct way? I am having trouble seeing how it will compare one integer to the next in a loop .