_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › SimpleQuiz1

import java.util.*;

public class QuizEx1 {

	public static void main(String[] args){
		String[] data = { 
                "れ 譴 れ螳  蟆?`2`final`True`if`public", 
                "れ 譴 覦 一一螳  蟆?`5`&`|`++`!=`/`^", 
                "れ 譴 覃 覦螳  覩誤 れ?`1`void`null`false", 
        };
		
		int[] answer = {2, 6, 1};
		int score = 0;
		Scanner s = new Scanner(System.in);
		shuffle(data);
		
		for(int i=0;i<data.length;i++){
			String[] strArr = data[i].split("`");
			
			for(int j=0;j<strArr.length;j++){
				switch(j){
					case 0 : 
						System.out.println("[" + (i+1) + "]" + strArr[j]);
						break;
					case 1 : 
						break;
					default :
						System.out.print(j-1 + "." + strArr[j] + " ");
				}
			}
			System.out.print("\r\n[]");
			
			if (answer[i] == Integer.parseInt(s.nextLine())){
				score++;
			}
					
			System.out.println("");
							
		} //for
		
		System.out.println("糾/豌企誤 : " + score + "/" + data.length);
	} //main
	
	public static void shuffle(String[] data){
		if (data.length > 0){
			int rand;
			String tmp;
			
			for(int i=0; i<data.length;i++){
				rand = (int)(Math.random() * 10 % data.length);
				tmp = data[i];
				data[i] = data[rand];
				data[rand] = tmp;
			}
		}
	} //shuffle
}
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:53

企 覈襯企 蟆讌 れ蠍語 螻 蟆企. ( )