今天我在运行一个程序时遇到了一个死循环。
下面是改正后的代码。改正前的代码被我放在了 102-105行的注释里。从前后代码之间的关系来看,错误的代码仅仅是正确代码的简化。而这个简单的简化,却给我带来了一个不可预知的死循环,也就是有时能够正常运行,有时在该位置死循环。我所使用的编译器是:gcc 4.8.3 20140911 (Red Hat 4.8.3-7)。
/*这里是程序注释
*程序名:rand33
*作 者:zyehh
*版 本:14
*日 期:2014-3-15-2014-11-22
*作 用:对33个双色球红号随机排序,序列输出文件为 ssq33rand.data。根据之也阵列产生48注每注6个号码,输出文件为 tozhu.txt。
*说 明:
2014-4-19增加了B[34]用于踢号,及踢号功能(被剔除的号码由其它未剔除号码随机代替)。
2014-6-27修改了tozhu.txt的输出格式,以适应于淘宝彩票的文件上传。
2014-6-30增加了C[16]用于机选蓝号。并且修改了一部分函数用于与蓝号相关的操作。版本变更为1.0.0.2。
2014-8-1 增加了对蓝号的踢除。版本13。从13版起,版本号去除点号。
2014-8-5 修改一个bug: 踢号(蓝号)不彻底。
2014-11-22 修改了 102-104 行简化代码造成的一个小 bug。该 bug 造成有时踢号会使程序进入死循环。
*/
#define DEBUG
#include
char B[34] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}; //33号选号范围,1表示在选号范围,0表示不在选号范围。
char D[17] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}; //16号选号范围,1表示在选号范围,0表示不在选号范围。
int main(void)
//int main(int argc,char *argv[])
{
void rand33(char *,const char );
void short_hao(char *);
void ti_hao(char *);
char *ssq33 = "ssq33rand.data";
char *tozhu = "tozhu.txt";
int inti,intm;
FILE *fp ,*fpo;
int lan;
char ch;
char A[33] = {17,4,27,13,11,14,21,7,31,22,3,19,26,8,24,18,5,29,10,9,1,15,6,25,30,12,33,2,20,23,32,28,16};
char C[16] = {6,9,4,14,7,11,3,1,2,8,15,5,12,16,13,10};
char hao[6];
if((fp = fopen(ssq33, "rb")) == NULL){
rand33(A,33);
rand33(C,16);
}
else {
if (0 == fread(A, sizeof(A), 1, fp)) ;
if (0 == fread(C, sizeof(C), 1, fp)) ;
}
rand33(A,33);
rand33(C,16);
printf("红号随机系列:\n");
for ( inti = 0; inti < 33; inti++) {
printf("%.2d ",A[inti]);
}
printf("\n蓝号随机系列:\n");
for ( inti = 0; inti < 16; inti++) {
printf("%.2d ",C[inti]);
}
if (fp) fclose(fp);
if((fpo = fopen(tozhu, "wb")) == NULL){
printf("未能创建数据文件 %s。\n",tozhu);
return 0;
}
printf("\n**********机选准备就绪**********\n");
printf("**********请输入确定踢除的红号码,以0结束:\n");
do {
scanf("%d",&intm);
if (intm < 34 && intm > 0) B[intm]=0;
} while (0 != intm);
/* do {
ch = getchar();
#ifdef DEBUG
printf("%s",ch);
#endif
}while(10 != ch);*/
printf("**********请输入确定踢除的蓝号码,以0结束:\n");
do {
scanf("%d",&intm);
if (intm < 17 && intm > 0) D[intm]=0;
} while (0 != intm);
/*do {
ch = getchar();
#ifdef DEBUG
printf("%s",ch);
#endif
}while(10 != ch);*/
printf("\n");
printf("投注号码第1组:\n");
hao[0] = A[24];
hao[1] = A[26];
hao[2] = A[27];
hao[3] = A[30];
hao[4] = A[31];
hao[5] = A[32];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
lan = 0;
while (0 == D[C[lan]]) {
lan++;
lan %= 16;
}
/* while (0 == D[C[lan]]) { 2014-11-22将此段修改,由于某种情况,此段出现了死循环。
lan = (lan++) % 16;
}
*/
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[0];
hao[1] = A[1];
hao[2] = A[2];
hao[3] = A[3];
hao[4] = A[4];
hao[5] = A[5];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[6];
hao[1] = A[7];
hao[2] = A[8];
hao[3] = A[9];
hao[4] = A[10];
hao[5] = A[11];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[12];
hao[1] = A[13];
hao[2] = A[14];
hao[3] = A[15];
hao[4] = A[16];
hao[5] = A[17];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[18];
hao[1] = A[19];
hao[2] = A[20];
hao[3] = A[21];
hao[4] = A[22];
hao[5] = A[23];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[24];
hao[1] = A[25];
hao[2] = A[26];
hao[3] = A[27];
hao[4] = A[28];
hao[5] = A[29];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
printf("\n");
printf("投注号码第2组:\n");
hao[0] = A[0];
hao[1] = A[6];
hao[2] = A[12];
hao[3] = A[18];
hao[4] = A[24];
hao[5] = A[30];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
lan++;
while (0 == D[C[lan]]) {
lan++;
lan %= 16;
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[1];
hao[1] = A[7];
hao[2] = A[13];
hao[3] = A[19];
hao[4] = A[25];
hao[5] = A[31];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[2];
hao[1] = A[8];
hao[2] = A[14];
hao[3] = A[20];
hao[4] = A[26];
hao[5] = A[32];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[3];
hao[1] = A[9];
hao[2] = A[15];
hao[3] = A[21];
hao[4] = A[27];
hao[5] = A[6];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[4];
hao[1] = A[10];
hao[2] = A[16];
hao[3] = A[22];
hao[4] = A[28];
hao[5] = A[32];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[5];
hao[1] = A[11];
hao[2] = A[17];
hao[3] = A[23];
hao[4] = A[29];
hao[5] = A[31];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
printf("\n");
printf("投注号码第3组:\n");
hao[0] = A[0];
hao[1] = A[7];
hao[2] = A[14];
hao[3] = A[21];
hao[4] = A[28];
hao[5] = A[30];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
lan++;
while (0 == D[C[lan]]) {
lan++;
lan %= 16;
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[1];
hao[1] = A[8];
hao[2] = A[15];
hao[3] = A[22];
hao[4] = A[29];
hao[5] = A[30];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[2];
hao[1] = A[9];
hao[2] = A[16];
hao[3] = A[23];
hao[4] = A[24];
hao[5] = A[31];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[3];
hao[1] = A[10];
hao[2] = A[17];
hao[3] = A[18];
hao[4] = A[25];
hao[5] = A[32];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[4];
hao[1] = A[11];
hao[2] = A[12];
hao[3] = A[19];
hao[4] = A[26];
hao[5] = A[10];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[5];
hao[1] = A[6];
hao[2] = A[13];
hao[3] = A[20];
hao[4] = A[27];
hao[5] = A[32];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
printf("\n");
printf("投注号码第4组:\n");
hao[0] = A[0];
hao[1] = A[8];
hao[2] = A[16];
hao[3] = A[19];
hao[4] = A[27];
hao[5] = A[7];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
lan++;
while (0 == D[C[lan]]) {
lan++;
lan %= 16;
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[1];
hao[1] = A[9];
hao[2] = A[17];
hao[3] = A[20];
hao[4] = A[28];
hao[5] = A[25];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[2];
hao[1] = A[10];
hao[2] = A[12];
hao[3] = A[21];
hao[4] = A[29];
hao[5] = A[30];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[3];
hao[1] = A[11];
hao[2] = A[13];
hao[3] = A[22];
hao[4] = A[24];
hao[5] = A[30];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[4];
hao[1] = A[6];
hao[2] = A[14];
hao[3] = A[23];
hao[4] = A[25];
hao[5] = A[31];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[5];
hao[1] = A[7];
hao[2] = A[15];
hao[3] = A[18];
hao[4] = A[26];
hao[5] = A[32];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
printf("\n");
printf("投注号码第5组:\n");
hao[0] = A[0];
hao[1] = A[9];
hao[2] = A[13];
hao[3] = A[23];
hao[4] = A[26];
hao[5] = A[32];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
lan++;
while (0 == D[C[lan]]) {
lan++;
lan %= 16;
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[1];
hao[1] = A[10];
hao[2] = A[14];
hao[3] = A[18];
hao[4] = A[27];
hao[5] = A[11];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[2];
hao[1] = A[11];
hao[2] = A[15];
hao[3] = A[19];
hao[4] = A[28];
hao[5] = A[6];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[3];
hao[1] = A[6];
hao[2] = A[16];
hao[3] = A[20];
hao[4] = A[29];
hao[5] = A[7];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[4];
hao[1] = A[7];
hao[2] = A[17];
hao[3] = A[21];
hao[4] = A[24];
hao[5] = A[30];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[5];
hao[1] = A[8];
hao[2] = A[12];
hao[3] = A[22];
hao[4] = A[25];
hao[5] = A[31];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
printf("\n");
printf("投注号码第6组:\n");
hao[0] = A[0];
hao[1] = A[10];
hao[2] = A[15];
hao[3] = A[20];
hao[4] = A[25];
hao[5] = A[31];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
lan++;
while (0 == D[C[lan]]) {
lan++;
lan %= 16;
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[1];
hao[1] = A[11];
hao[2] = A[16];
hao[3] = A[21];
hao[4] = A[26];
hao[5] = A[32];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[2];
hao[1] = A[6];
hao[2] = A[17];
hao[3] = A[22];
hao[4] = A[27];
hao[5] = A[8];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[3];
hao[1] = A[7];
hao[2] = A[12];
hao[3] = A[23];
hao[4] = A[28];
hao[5] = A[9];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[4];
hao[1] = A[8];
hao[2] = A[13];
hao[3] = A[18];
hao[4] = A[29];
hao[5] = A[10];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[5];
hao[1] = A[9];
hao[2] = A[14];
hao[3] = A[19];
hao[4] = A[24];
hao[5] = A[30];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
printf("\n");
printf("投注号码第7组:\n");
hao[0] = A[0];
hao[1] = A[9];
hao[2] = A[14];
hao[3] = A[22];
hao[4] = A[29];
hao[5] = A[30];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
lan++;
while (0 == D[C[lan]]) {
lan++;
lan %= 16;
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[1];
hao[1] = A[10];
hao[2] = A[15];
hao[3] = A[23];
hao[4] = A[24];
hao[5] = A[8];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[2];
hao[1] = A[11];
hao[2] = A[16];
hao[3] = A[18];
hao[4] = A[25];
hao[5] = A[30];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[3];
hao[1] = A[6];
hao[2] = A[17];
hao[3] = A[19];
hao[4] = A[26];
hao[5] = A[31];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[4];
hao[1] = A[7];
hao[2] = A[12];
hao[3] = A[20];
hao[4] = A[27];
hao[5] = A[32];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[5];
hao[1] = A[8];
hao[2] = A[13];
hao[3] = A[21];
hao[4] = A[28];
hao[5] = A[31];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
printf("\n");
printf("投注号码第8组:\n");
hao[0] = A[0];
hao[1] = A[11];
hao[2] = A[17];
hao[3] = A[20];
hao[4] = A[24];
hao[5] = A[30];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
lan++;
while (0 == D[C[lan]]) {
lan++;
lan %= 16;
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[1];
hao[1] = A[6];
hao[2] = A[12];
hao[3] = A[21];
hao[4] = A[25];
hao[5] = A[31];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[2];
hao[1] = A[7];
hao[2] = A[13];
hao[3] = A[22];
hao[4] = A[26];
hao[5] = A[32];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[3];
hao[1] = A[8];
hao[2] = A[14];
hao[3] = A[23];
hao[4] = A[27];
hao[5] = A[30];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[4];
hao[1] = A[9];
hao[2] = A[15];
hao[3] = A[18];
hao[4] = A[28];
hao[5] = A[31];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
hao[0] = A[5];
hao[1] = A[10];
hao[2] = A[16];
hao[3] = A[19];
hao[4] = A[29];
hao[5] = A[32];
ti_hao(hao);
short_hao(hao);
for ( inti = 0; inti < 6; inti++){
printf("%.2d ",hao[inti]);
}
printf("%.2d\n",C[lan]);
fprintf(fpo,"%.2d %.2d %.2d %.2d %.2d %.2d+",hao[0],hao[1],hao[2],hao[3],hao[4],hao[5]);
fprintf(fpo,"%.2d\n",C[lan]);
fclose(fpo);
if((fpo = fopen(ssq33, "wb")) == NULL){
printf("未能创建数据文件 %s。\n",ssq33);
}
rand33(A,33);
rand33(C,16);
fwrite(A, sizeof(A), 1, fpo);
fwrite(C, sizeof(C), 1, fpo);
fclose(fpo);
return 0;
}
void rand33(char *T, const char uper){
int intt;
unsigned char inti,intj;
int a,b,times;
srand((unsigned)time(NULL) + (unsigned)clock());
times = rand();
times %= 200;
for ( inti = 0 ; inti < times; inti++) {
for ( intj = 0; intj < uper; intj++) {
a = rand();
a %= uper;
b = rand();
b %= uper;
intt = T[a];
T[a] = T[b];
T[b] = intt;
}
}
}
void short_hao(char *T){
int intt;
int inti,intj;
for ( inti = 0; inti < 5; inti++) {
for ( intj = inti + 1; intj < 6; intj++) {
if ( T[inti] > T[intj] ) {
intt = T[inti];
T[inti] = T[intj];
T[intj] = intt;
}
}
}
}
void ti_hao(char *T){
int intt;
int inti;
for ( inti = 0; inti < 6; inti++) {
if ( 1 == B[T[inti]] ) continue;
ran:
intt = ( rand() % 33 ) + 1;
if ( 1 != B[intt] ) goto ran;
if ( intt == T[0] ) goto ran;
if ( intt == T[1] ) goto ran;
if ( intt == T[2] ) goto ran;
if ( intt == T[3] ) goto ran;
if ( intt == T[4] ) goto ran;
if ( intt == T[5] ) goto ran;
T[inti] = intt;
}
}