3、最后在彩票小程序主页面右上角找到信息修改,并找到刮奖公开信息点击修改即可。
已调试完毕,共3003条!!!每输出40条按任一键继续...,保证结果万无一失,你可以查看下,源程序如下:#include "stdio.h"
main()
{int i,j,k,m,n
long int count=0
for(i=1i<=15i++)
for(j=i+1j<=15j++)
for(k=j+1k<=15k++)
for(m=k+1m<=15m++)
for(n=m+1n<=15n++)
{if(iden(i,j,k,m,n))
printf("No %ld : %5d%5d%5d%5d%5d\n",++count,i,j,k,m,n)
if(count%45==0) getchar()
}
}
iden(int i,int j,int k,int m,int n)
{if(i==j||i==k||i==m||i==n||j==k||j==m||j==n||k==m||k==n||m==n)
return 0
else
return 1
}
再增加两个变量,修改下程序可以35选5,我机子是P4 cpu1.8G 内存是512M,跑了好久,估计要两个小时左右!!!没耐心等下去,有朋友想试下的我把程序弄下面来了!!
#include "stdio.h"
main()
{int i,j,k,m,n,q,w
long int count=0
for(i=1i<=35i++)
for(j=i+1j<=35j++)
for(k=j+1k<=35k++)
for(m=k+1m<=35m++)
for(n=m+1n<=35n++)
for(q=n+1q<=35q++)
for(w=q+1w<=35w++)
{if(iden(i,j,k,m,n,q,w))
printf("No %ld : %5d%5d%5d%5d%5d%5d%5d\n",++count,i,j,k,m,n,q,w)
if(count%45==0) getchar()
}
}
iden(int i,int j,int k,int m,int n,int q,int w)
{if(i==j||i==k||i==m||i==n||i==q||i==w||j==k||j==m||j==n||j==q||j==w||k==m||k==n||k==q||k==w||m==n||m==q||m==w||n==q||n==w||q==w)
return 0
else
return 1
}
自选的时候有点小bug,你再调调就ok了
#include <stdio.h>#include <time.h>
#include <string.h>
#include <stdlib.h>
#define N 22
#define M 5
void print_result(int *input)
{
int i=0
printf("The result is:\n")
for(i=0i<Ni++)
{
if(input[i])
printf("%-3d",i)
}
printf("\n\n")
}
void machine(int *input)
{
int i=0
int num=0
while(num<M)
{
int temp = (rand()%N) + 1
if(input[temp])
continue
else
{
input[temp] = 1
num++
}
}
}
void man(int *input)
{
int i=0,valid=0
int temp[M]={0}
printf("input your choice:\n")
while(valid == 0)
{
valid = 1
for(i=0i<Mi++)
{
scanf("%d",&temp[i])
input[temp[i]] = 1
if(!(temp[i]>0 && temp[i] <= 22))
{
//printf("temp:%d\n",temp[i])
valid = 0
}
}
if(valid == 0)
printf("Your input number is wrong,please input again!\n")
}
}
int main(void)
{
srand(time(0))
int array[22]={0}
char choice[8]={0}
while(1)
{
memset(array,0x00,sizeof(array))
printf("input 1 for machine-processed...\n")
printf("input 2 for man-made...\n")
printf("input Ctrl+C to EXIT...\n")
scanf("%s",choice)
if(strncmp(choice,"1",1) == 0)
{
machine(array)
print_result(array)
}
else if(strncmp(choice,"2",1) == 0)
{
man(array)
print_result(array)
}
else
continue
}
return 0
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)