import java.util.*;
public class CaiShuZi {
public static void main(String[] args) {
System.out.println("请输入一个0~99之间的数字:");
int num = 0; // 输入值变量
int number = (int) (Math.random() * 101); // 产生随机数
Scanner input = new Scanner(System.in);
for (int counter = 1; counter < 20; counter++) {
System.out.print("请输入数值:");
num = input.nextInt(); //输入数值
/*
* 判断结果
*/
if(num>number){
System.out.println("大了点");
continue;
}else if(num < number) {
System.out.println("小了点");
continue;
}else if (num == number && counter == 1) {
System.out.println("你太有才了!");
break;
} else if (num == number && counter >= 2 && counter <= 6) {
System.out.println("这么快就猜出来了,小同志,很聪明么!");
break;
} else {
System.out.println("猜了半天才猜出来,小同志,尚需努力!");
break;
}
}
System.out.println("\n\n程序结束");
}
}