Please enable JavaScript in your browser to load website properly.

Click here if you'd like to learn how.

자바 질문좀ㅠㅠㅠ

중령 느사아아 | 17-05-28 00:39:35 | 조회 : 280 | 추천 : -


void getanswer(int limit){
Scanner s = new Scanner(System.in);
long initTime = System.currentTimeMillis();
for(int i = 0;i<ranswer.length;i++){
System.out.printf("%d번째 숫자 : ",i+1);
int y= s.nextInt();
if(y!=uanswer[i]){System.out.print("틀렸습니다!!n");
break;}
if(System.currentTimeMillis()-initTime<limit){System.out.print("Time out!!");break;}
else if(y==uanswer[i]){System.out.printf("%d번째 는 맞았군요!!!!n",right+1);right++;}
if(right==ranswer.length){System.out.println("정답입니다");
win = true;}
}
}
요기서 if(System.currentTimeMillis()-initTime<limit){System.out.print("Time out!!");break;}요부분이 잘못된건지 계속 첫글자만 받으면 브레이크 걸림;;;
limit에 40000집어넣었는도 그럼;;;;한 10억 쯤 집어넣어야하나??
SNS로 공유하기
< 1 2 3 4 5 >