#define numeric_b '0'
#define numeric_e '9'
/** init string intervals ---*/
static char c0=numeric_b;
static char c1=numeric_b;
static char c2=numeric_b;
static char c3=numeric_b;
static char c4=numeric_b;
static char c5=numeric_b;
static char c6=numeric_b;
static char c7=numeric_b;
/** init start & end ----------------*/
static const char en = numeric_e +1;
static const char st = numeric_b +1;
void str_in(int length){
FILE * fp = fopen("list.txt","w");
switch(length){
case 0:
printf("%c\n",c0);break;
case 1:
printf("%c%c\n",c0,c1);break;
case 2:
printf("%c%c%c\n",c0,c1,c2);break;
case 3:
printf("%c%c%c%c\n",c0,c1,c2,c3);break;
case 4:
printf("%c%c%c%c%c\n",c0,c1,c2,c3,c4);break;
case 5:
printf("%c%c%c%c%c%c\n",c0,c1,c2,c3,c4,c5);break;
case 6:
printf("%c%c%c%c%c%c%c\n",c0,c1,c2,c3,c4,c5,c6);break;
case 7:
printf("%c%c%c%c%c%c%c%c\n",c0,c1,c2,c3,c4,c5,c6,c7);break;
}
fclose(fp);
}
void permute(int length){
while(c0<=en){
str_in(length);
c0++;
if(c0==en && length==0){break;}
if(c0==en){
c0=st;
c1++;
if(c1==en && length==1){break;}
if(c1==en){
c1=st;
c2++;
if(c2==en && length==2){break;}
if(c2==en){
c2=st;
c3++;
if(c3==en && length==3){break;}
if(c3==en){
c3=st;
c4++;
if(c4==en && length==4){break;}
if(c4==en){
c4=st;
c5++;
if(c5==en && length==5){break;}
if(c5==en){
c5=st;
c6++;
if(c6==en && length==6){break;}
if(c6==en){
c6=st;
c7++;
if(c7==en && length==7){break;}
}
}
}
}
}
}
}
}
}