import java.util.Scanner;
class Day07HomeWork3 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
//1
for (; ; ) {
int a=((int)(Math.random()*100)-1)/33;
System.out.println("请输入一个整数代表你的手掌,0=石头,1=剪刀,2=布");
int b=sc.nextInt();
if(a==b) {
System.out.println("平手");
}else if (a==0 &&b==1) {
System.out.println("输了");
}else if (a==0 &&b==2) {
System.out.println("赢了");
}else if (a==1 &&b==0) {
System.out.println("赢了");
}else if (a==1 &&b==2) {
System.out.println("输了");
}else if (a==2 &&b==0) {
System.out.println("输了");
}else if(b>2 || b<0) {
System.out.println("能不能好好玩");
}else {
System.out.println("赢了");
}
}
}
} |
|