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=0i<7i++)
scanf("%d",&p[i])
printf("\nKai jiang hao ma shi: ")
for(i=0i<7i++)
scanf("%d",&q[i])
}
pd(int p[],int q[])
{
int i,n=0
for(i=0i<6i++)
if(p[i]==q[i])
n++
return(n)
}
#include<stdio.h>肢颤悔void main()
{
int a[]={1,2,3,4,5,6,7}
int b[7],i,j,count=0,max=0,maxflag
for(i=0i<7i++)
scanf("%d",&b[i])
i=0
while(i<7)
{
j=0
count=0
if(b[i]==a[j])
while(i<7 && j<7 && b[i]==a[j]) i++,j++,count++
else
i++
if(max<count) {max =countmaxflag=i}
}
count = max
if(count==7) printf("特等奖\n")
else 历正if(count==6)
{
if(maxflag==7)
printf("二等奖\n")
else
printf("一等奖\n")
}
else if(count==5)
{
if(maxflag==7)
printf("三等奖\n")
else
printf("二等奖\n")
}
else if(count==4)
{
if(maxflag==7)
printf("四等奖\n")
else
printf("三等奖\n"洞哗)
}
else if(count==3)
{
if(maxflag==7)
printf("五等奖\n")
else
printf("四等奖\n")
}
else if(count==2 && maxflag!=7)
printf("五等奖\n")
else
printf("没中奖\n")
}
这是我写的程序 如有问题请发消息给我#include<stdio.h>
int fun(int *a,int *b)
{ int i,j=0
for(i=0i<6i++)
{if(a[i]==b[i]&&a[i+1]==b[i+1])
j++
else
j=0
}
return j
}
void main()
{int i,k
int b[7],a[7]={0,1,2,3,4,5,6}
for(i=0i<7i++)
scanf("%d",&b[i])
k=fun(a,b)
if(a[6]==b[6]&&k==6)
printf("碰租特等奖纤尘")
else
switch(k)
{ case 0:printf("谢谢")break
case 4:printf("三等奖")break
case 5:printf("二笑竖兆等奖")break
case 6:printf("一等奖")break
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)