5.
Write a ConsoleProgram that reads in a list of integers, one per line, until a sentinel value of 0 (which you should be able to change easily to some other value). When the sentinel is read, your program should display the smallest and largest values in the list, as illustrated in this sample run:

Your program should handle the following special cases:
- If the user enters only one value before the sentinel, the program should report that value as both the largest and smallest.
- If the user enters the sentinel on the very first input line, then no values have been entered, and your program should display a message to that effect.
程序源代码:
本文介绍了一个名为FindRange的Java控制台程序,该程序读取一系列整数直到遇到哨兵值0,并输出这些整数中的最大值和最小值。程序能够处理特殊输入情况,如只输入一个值或直接输入哨兵值。
4657





