終極密碼
import java.util.*;
public class Game {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int x = (int)(Math.random()*99)+1;
while(true){
System.out.println("請輸入 1 ~ 99");
int y = scanner.nextInt();
if(x == y){
System.out.println("對不起害到你");
break;
}else if(x > y){
System.out.println("大一點");
}else{
System.out.println("小一點");
}
}
}
}
沒有留言:
張貼留言