main()
{
int p[7],q[7],n,i; /****p:投註號碼,q:開獎號碼****/
char c='0';
st(p,q); /****初始化****/
n=pd(p,q);
switch (n)
{
case 6:
{
if(p[6]==q[6]) c='!';
else c='1';
} break;
case 5:
{
if(p[1]!=q[1]||p[4]!=q[4]) c='3';
if(p[2]!=q[2]||p[3]!=q[3]) c='0';
else c='2';
} break;
case 4:
{
if((p[0]!=q[0]&&p[1]!=q[1])||(p[0]!=q[0]&&p[5]!=q[5])||(p[4]!=q[4]&&p[5]!=q[5]))
c='3';
else c='0';
}
}
switch (c )
{
case '!': printf("\nni zhong le te deng jiang!");break;
case '1': printf("\nni zhong le 1 deng jiang!"); break;
case '2': printf("\nni zhong le 2 deng jiang!"); break;
case '3': printf("\nni zhong le 3 deng jiang!"); break;
case '0': printf("\nni mei you zhong jiang!"); break;
}
getch();
}
st(int p[],int q[])
{
int i;
printf("\nXuan zhe tou zhu hao ma: ");
for(i=0;i<7;i++)
scanf("%d",&p[i]);
printf("\nKai jiang hao ma shi: ");
for(i=0;i<7;i++)
scanf("%d",&q[i]);
}
pd(int p[],int q[])
{
int i,n=0;
for(i=0;i<6;i++)
if(p[i]==q[i])
n++;
return(n);
}