Hi everyone. I am trying to write a java program that allows the user to input as many integer values. At the end, it is supposed to figure out which is the largest and smallest number. -99 is used to quit if the user no longer wants to put in anymore values. Also, if -99 is entered in the first time, it will say "You did not enter any numbers". I wrote this code but am having a hard time getting it figure out which is the smallest.
i have a question about initializing min, max, and input. do i have to put int min(max,input) = 0? i feel that THAT is the problem but if i don't set it to a value it won't compile
There are several ways to initialize them :
1. Use Integer.MIN_VALUE and Integer.MAX_VALUE
2. Or, the first time the user inputs a value, initialize both min and max to that value
wei qi
Greenhorn
Joined: Feb 24, 2011
Posts: 5
posted
0
how do you the 2nd? (first time the user inputs a value, initialize both min and max to that value)