标签:
import java.util.Scanner;
public class work {
public static void main(String[] args) { // TODO Auto-generated method stub
int b=(int)(Math.random()*15+1);
Scanner cin=new Scanner(System.in);
System.out.println("请输入一个0-15以内的数字:");
int a=cin.nextInt(); int count=1;
while(b != a && count<=3){
System.out.println(a>b? "太大了":"太小了");
System.out.println("请输入一个1-15以内的数字:");
a=cin.nextInt();
count++;
break;
} if(a==b){
}else if(count<=3){ System.out.println("恭喜你赢了");
}else{ System.out.println("你输了"); }
}
}
标签:
原文地址:http://www.cnblogs.com/zh13197490940/p/5489779.html