되는대로 살자

[C언어 프로젝트] 미니게임 모음 랜덤-복권게임 본문

2009~2014/C/C++

[C언어 프로젝트] 미니게임 모음 랜덤-복권게임

malu 2010. 11. 5. 17:11




0123














함수 구현

void bucgoun()
{
    system("cls");                                                             
    int NumChk[6]; 
    int RandNum[7];                  
    int chance;
 srand((unsigned)time(NULL));
    printf("1~45 복권 맞추기\n");
    for(i=0; i<=5; i++)
    {
    printf("입력=> ");
    scanf("%d",&NumChk[i]); 

    if( NumChk[i] > 45 || NumChk[i] < 1 )
    {
        printf("1~45 만 입력하시오\n");
        --i;       
    }
    }
    RandNum[0] = rand() % 45 + 1;                             
             RandNum[1] = rand() % 45 + 1;                
             RandNum[2] = rand() % 45 + 1;                  
             RandNum[3] = rand() % 45 + 1;
             RandNum[4] = rand() % 45 + 1;
             RandNum[5] = rand() % 45 + 1;
             RandNum[6] = rand() % 45 + 1;

             printf("로또번호: ");
             for(i=0; i<=5; i++)               
             {
             printf("%d ",RandNum[i]);
             delay(1500);                                           
             }
             delay(1500);                                           
             printf("보너스: %d",RandNum[6]);
             delay(1500);                                                
             printf("\n");                                                  
             printf("입력번호: ");
            
             for(i=0; i<=5; i++)                                               
             {
             printf("%d ",NumChk[i]);
             delay(1500);                                                      
             }
             printf("한번 더? (1.yes / 2.no)\n");
             printf("숫자=> ");
             scanf("%d",&chance);
             if(chance == 1 )
             {
                       bucgoun();
             }
             if(chance == 2)
             {
             delay(1500);                                                             
             system("cls");
             randomGameMoum(); 
             }                                                           
}