1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | import java.util.*; public class P70_4{ public static void main (String[]args){ Scanner input = new Scanner(System.in); System.out.println("请输入一个整数a:"); System.out.println("请保持:a<b<c."); int a = input.nextInt();//从键盘录入a System.out.println("请在输入一个整数b:"); int b = input.nextInt();//从键盘录入b System.out.println("请再一次输入一个整数c:"); int c = input.nextInt();//从键盘录入c if (( a < b && a < c )&& ( b < c )) { System.out.println("恭喜,输入正确!"); System.out.println("a为:"+a+"\nb为:"+b+"\nc为:"+c); } else { System.out.println("对不起,输入错误!请重新输入,并保持a<b<c."); } } } |
1 | 对数据比较有要求,别的不需要太多逻辑. |