Last active
August 29, 2015 14:13
-
-
Save komo91/cea5ed28201aaa656849 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
import java.util.Random; | |
public class Suuziate { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
Random rn = new Random(); | |
int yosou = 0; | |
int kaisu = 0; | |
int a = rn.nextInt(50) + 1; | |
System.out.println("難易度を入力してください"); | |
int naindo = sc.nextInt(); | |
switch(naindo) { | |
case 1: | |
kaisu = 30; | |
break; | |
case 2: | |
kaisu = 20; | |
break; | |
case 3: | |
kaisu = 10; | |
break; | |
} | |
System.out.println(kaisu + "回以内に数字を当ててください"); | |
for(int i = 0; i < b; i++) { | |
yosou = sc.nextInt(); | |
if(yosou < a) { | |
System.out.println("小さいです"); | |
} else if(yosou > a) { | |
System.out.println("大きいです"); | |
} else if(yosou == a){ | |
System.out.println("正解です"); | |
} else { | |
System.out.println("ゲームオーバーです"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment