i am stuck with looping problem
program reads text file with some random positive and negative numbers (there is only twelve numbers)
and it needs to find highest number and lowest number
i need to use if statement where it checks for not end of file
and sets largest to number and sets smallest to number
something like this
if(not end of file)
set largest to number
set smallest to number
endif
numbers are read properly since i got everything else working correctly, like how many positive and negative, count, average, even and odd
i just dont understand how to get largest and smallest part
i would appreciate some help
That's pretty much right, except you have an unconditional assignment of largestNumber and smallestNumber that will make your results incorrect. You only want to do that assignment the first time you read a number.
And I think this would be annoying to implement as anything but a loop...you would end up with several repeated reads and copy & pasted if() statements and such.