日期:2014-05-20 浏览次数:20840 次
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;
}
}
}