51,409
社区成员
发帖
与我相关
我的任务
分享
public static void main(String[] args) {
JiaFa he = new JiaFa();
Scanner sc = new Scanner(System.in);
while (true) {
he.showTitle();
he.JiaF();
int c;
try {
c = sc.nextInt();
if (he.sum == c) {
System.out.println("正确。");
} else {
System.out.println("错误,正确答案为: " + he.sum);
}
} catch (InputMismatchException e) {
String s = sc.nextLine();
if (s.equals("q"))
break;
}
}
}