C 언어로 숫자 맞추기 게임.
744 단어 숫자 맞추기 게임
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
int start=1;
while(start)
{
printf(" :
");
printf("1:
");
printf("0:
");
scanf("%d",&start);
switch(start)
{
case 1:
{
int input=0;
int random=0;
srand(time(NULL));
random=rand()%100;
while(1)
{
printf(" :");
scanf("%d",&input);
if(input==random)
{
printf(" !
");
break;
}
else if(input>random)
printf("
");
else
printf("
");
}
break;
}
case 0:
break;
}
return 0;
}
return 0;
}