#include
#include
#include
int main(){
int A,B,C,D;
int n=1;
int a,b,c,d;
int strike=0,ball=0;
int i;
srand(time(0));
A=rand()%10;
B=rand()%10;
while(A==B)
{
B=rand()%10;
}
C=rand()%10;
while(A==C||B==C)
{
C=rand()%10;
}
D=rand()%10;
printf("%d %d %d %d n",A,B,C,D);
while(A==D||B==D|| C==D)
{
D=rand()%10;
}
printf("--------------------------------------n");
printf(" ¾ß±¸°ÔÀÓ n");
printf("--------------------------------------n");
printf("1) ÄÄÇ»ÅÍ°¡ 4°³ÀÇ ÇÑÀÚ¸® ¼ö¸¦ »ý°¡ÇÕ´Ï´Ù. n");
printf("2) »ç¿ëÀÚ°¡ 45°³ÀÇ ¼ýÀÚ¸¦ ÀÔ·ÂÇÕ´Ï´Ù.n");
printf("3) ¼ýÀÚ°¡ °°°í À§Ä¡°¡ °°À¸¸é ½ºÆ®¶óÀÌÅ© ÀÔ´Ï´Ù. n");
printf("4) ¼ýÀÚ°¡ °°À¸³ª À§Ä¡°¡ ´Ù¸£¸é º¼ÀÔ´Ï´Ù. n");
printf("*) ¼ýÀÚ´Â ¶ç¾î¼ ÀÔ·ÂÇϼ¼¿ä.¤Ó(¿¹: 1 4 5 7)n");
printf("----------------------------------------------------n");
printf("»õ °ÔÀÓÀÔ´Ï´Ùn");
while(1){
printf("(%d)> ",n);
scanf("%d %d %d %d",&a,&b,&c,&d);
{
if(A==a)strike++;
if(B==b)strike++;
if(C==c)strike++;
if(D==d)strike++;
if(a==B||a==C||a==D)ball++;
if(b==A||b==C||b==D)ball++;
if(c==A||c==B||c==D)ball++;
if(d==A||d==B||d==C)ball++;
}
if(strike!=4) printf(" ( %d ½ºÆ®¶óÀÌÅ© %d º¼)n",strike,ball);
else break;
n++;
strike=0;
ball=0;
}
printf(" ÃàÇÏÇÕ´Ï´Ù. %d step¸¸¿¡ ¸ÂÃß¾ú½À´Ï´Ù!!n",n);
}