标签:
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
double jieguo();
void main(){
int i,k;
int m,n;
int j;
printf("请输入购买的号码:\n");
scanf("%d",&i);
j=jieguo();
if(i==j)
printf("赢得的金额是500元\n");
if(i%100==j%100)
printf("赢得的金额是150元\n");
for(m=1;m<=5;m++){
i=i%100;
for(k=1,n=0;k<=5;k++){
j=j%100;
if(i==j)
n=n+1;
}
}
printf("%d\n",n);
if(n==5&&j%100==i%100)
printf("奖金是3000\n");
if((n==5&&j%100!=i%100)||(n==4&&j%100==i%100))
printf("奖金是200\n");
if((n==4&&j%100!=i%100)||(n==3&&j%100==i%100))
printf("奖金是10\n");
if((n==2&&j%100==i%100)||(n==1&&j%100==i%100)||(n==0&&j%100==i%100))
printf("奖金是5\n");
}
double jieguo(){
int a,b;
int i;
double sum;
srand(time(NULL));
for(i=1,sum=0;i<=6;i++){
a=rand()%37;
//printf("%d\n",a);
sum=sum*100;
sum +=a;
}
b=rand()%17;
sum=sum*100+b;
return sum;
}
标签:
原文地址:http://www.cnblogs.com/yjh123/p/5540520.html