게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
C언어 질문
게시물ID : computer_170584짧은주소 복사하기
작성자 : 미룻뜨
추천 : 0
조회수 : 248회
댓글수 : 1개
등록시간 : 2014/05/21 11:24:13
옵션
  • 베스트금지
실행은 되는데 1번째숫자 2번째숫자 3번째숫자 넘어가야되는데
2번째숫자만 계쏙 반복되요
 
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
main()
{
      int lottoA[5], lottoB[5];
      int Cnt, ChkCnt;
      int MatchPoint=0;
      char Bonus='X';
     
      for (Cnt=0;Cnt<=5;Cnt++)
      {
          Loop1:
                printf("%d번쨰 선택한 숫자 : ", Cnt+1);
                scanf("%d",&lottoA[Cnt]);
               
                if(lottoA[Cnt]<1 || lottoA[Cnt]>45)
                {
                                 printf("1~45사이 숫자 입력\n");
                                 goto Loop1;
                                 }
                                 if (Cnt=0)
                                 {
                                           for (ChkCnt=0;ChkCnt<Cnt;ChkCnt++)
                                           {
                                               if(lottoA[Cnt]==lottoA[ChkCnt])
                                               {
                                                         printf("이미 입력한 값.");
                                                         goto Loop1;
                                                         }
                                                         }
                                                         }
                                                         }
                                                        
                  srand((unsigned)time(NULL));
                  for( Cnt = 0 ; Cnt < 6 ; Cnt++ )
                  {
                  lottoA[Cnt] = rand()%45+1;
                  if ( lottoA[Cnt] == lottoA[Cnt+1] )
                  {
                       for( ChkCnt = 0; ChkCnt < 6; ChkCnt++ )
                       {
                            if( lottoA[Cnt] == lottoA[ChkCnt] )
                            {
                             lottoA[Cnt] = rand()%45+1;
                             ChkCnt = 1;
                            }
                            }
                            }
                            printf("로또번호는%d\n",lottoA[Cnt]);
                            }
                          
                                for(Cnt=0;Cnt<6;Cnt++)
                                {
                                                  for(ChkCnt=0;ChkCnt<6;ChkCnt++)
                                                      {
                                                                                     if(lottoA[Cnt]||lottoB[ChkCnt])
                                                                                     {
                                                                                                                       
                                                                                                                    }
                                                                                                                    }
                                                                                                                    }
                 
switch (ChkCnt)
 
{
       case 0: printf("꽝/n"); break;
       case 1: printf("1개맞음 100원/n"); break;
       case 2: printf("2개맞음 200원/n"); break;
       case 3: printf("3개맞음 300원/n"); break;
       case 4: printf("4개맞음 400원/n"); break;
       case 5: printf("5개맞음 500원/n"); break;
       }
      
system ("pause");
}
 
                                
로또 입니다
전체 추천리스트 보기
새로운 댓글이 없습니다.
새로운 댓글 확인하기
글쓰기
◀뒤로가기
PC버전
맨위로▲
공지 운영 자료창고 청소년보호