To findout smallest and largest numbers from text file

Pl guide me how to write a complete programme to findout a smallest and largest number from given problem:
e.g.
200
250
120
5
28
30
Read them from a file with an ifstream ( http://www.cplusplus.com/doc/tutorial/files/ ) and store them into a std::vector. Then set the smallest and largest variables to the first element in the vector and loop through the remaining elements comparing them to those two variables and reassigning when they're less than smallest and greater than largest.
Thanx for guidance. but how to write a complete programme for solving this problem
That's up to you, of course.
Try and do it for yourself based on filipe's guidance, if you get stuck on something specific post your code and then we will help you.
Topic archived. No new replies allowed.