예제 #1
0
int main (int argc, const char * argv[]) {
	int		rolls[ kMaxRoll + 1 ], threeDice, i;
	
	srand( clock() );
	
	for ( i=0; i<=kMaxRoll; i++ )
		rolls[ i ] = 0;
	
	for ( i=1; i <= 1000; i++ ) {
		threeDice = RollOne() + RollOne() + RollOne();
		++ rolls[ threeDice ];
	}
	
	PrintRolls( rolls );
	
	return 0;
}
예제 #2
0
파일: main.c 프로젝트: JackIrish/ios
int main (int argc, const char * argv[])
{
	int rolls[ 13 ], twoDice, i;
	
	srand( clock() );
	
	for ( i = 0; i < 13; i++ )
		rolls[ i ] = 0;
	
	for ( i = 1; i <= 1000; i++ ) {
		twoDice = RollOne() + RollOne();
		++ rolls[ twoDice ];
	}
	
	PrintRolls( rolls );
	
	return 0;
}