[C언어 프로젝트] 미니게임 모음 숫자-스피드숫자
함수 구현
void numcount()
{
system("cls");
int x,y,chance;
int num;
int key;
int stage;
srand((unsigned)time(NULL));
printf("난이도를 선택하세요.\n");
printf("(1.쉬움 2.보통 3.어려움)\n");
printf("선택=> ");
scanf("%d",&stage);
while(1)
{
i = rand() % 10 + 1;
x = rand() % 36;
y = rand() % 10;
system("cls");
printf("시작합니다.");
delay(1500);
system("cls");
gotoxy(x,y); printf("%d",i);
if(stage==1)
delay(300);
if(stage==2)
delay(100);
if(stage==3)
delay(40);
system("cls");
printf("입력=> ");
scanf("%d",&num);
if( num == i )
{
printf("정답입니다.");
delay(1500);
system("cls");
}
else
{
printf("오답입니다.");
delay(1500);
system("cls");
break;
}
}
delay(1000);
system("cls");
printf("한번 더? (1.yes / 2. no)\n");
printf("숫자=> ");
scanf("%d",&chance);
if( chance == 1 )
{
numcount();
}
if( chance == 2 )
{
delay(1000);
system("cls");
numGameMoum();
}
}