import java.util.Random;
public class craps
{
public static void main ( String[] args )
{
Random randomNumbers = new Random();
int a;
int b;
int totalwins =0;
int totalloses = 0;
int counts=0;
for( int e = 1; e<=10; e++)
{
a = 1 + randomNumbers.nextInt( 6 );
b = 1 + randomNumbers.nextInt( 6 );
int c = a + b;
if( c == 7 | c == 11 )
{
totalwins = totalwins+1;
counts = counts+1;
}
else if( c == 2 | c == 3 | c == 12 )
{
totalloses = totalloses+1;
counts = counts+1;
}
else
{
a = 1 + randomNumbers.nextInt( 6 );
b = 1 + randomNumbers.nextInt( 6 );
int d = a + b;
while ( c == d | d == 7 )
{
if ( c == d )
{
totalwins = totalwins+1;
counts = counts+1;
}
else if ( d == 7 )
{
totalloses = totalloses+1;
counts = counts+1;
}
a = 1 + randomNumbers.nextInt( 6 );
b = 1 + randomNumbers.nextInt( 6 );
d = a + b;
}
}
}
System.out.printf("total of wins are %d\n", totalwins);
System.out.printf("total of loses are %d\n", totalloses);
System.out.printf("total of counts are %d", counts);
}
}
크랩스 게임 아시죠 그거 하는데 왜 이게 꼭 카운트가 10이랑 같지 않을 까요 항상 모잘라요 제발 답변해주세요 불쌍한 대학생 한번만 도와주세요
그게 뭐야? 왜 안다고 니 멋대로 판단해. 안 해줄래.
크랩스?
뭔진 모르겠으나 디버깅하면 알 수 있지않나?