#include <stdio.h>
#include <string.h>
void strpre(char* dest,int sum)
{
char buffer[256]={'\0'};
strcpy(buffer,dest);
while(sum>0)
{
*dest++='0';
sum--;
}
int i=0;
while(buffer[i]!='\0') *dest++=buffer[i++];
}
void stralign(char* dest1,char* dest2,char sfill)
{
char buffer[256]={'\0'};
int len1=strlen(dest1);
int len2=strlen(dest2);
if (len1==len2) return;
int bc=0;
int i=0;
if(len1>len2)
{
i=0;
strcpy(buffer,dest2);
bc=len1-len2;
while(bc>0)
{
*dest2++=sfill;
bc--;
}
while(buffer[i]!='\0') *dest2++=buffer[i++];
}
else
{
i=0;
strcpy(buffer,dest1);
bc=len2-len1;
while(bc>0)
{
*dest1++=sfill;
bc--;
}
while(buffer[i]!='\0') *dest1++=buffer[i++];
}
}
void stracc(char* dest)
{
int len=strlen(dest);
int flag=0;
int tmp;
len--;
flag=(dest[len]-0x30+1) /10;
dest[len]=(dest[len]-0x30+1) %10+0x30;
while(len>0)
{
len--;
tmp=dest[len]-0x30+flag;
dest[len]=((dest[len]-0x30)+flag)%10+0x30;
flag=tmp/10;
}
}
int main()
{
char t1[256]={'\0'};
char t2[256]={'\0'};
char* p=&t1[0];
strcpy(t1,"0");
strcpy(t2,"123289324125");
//stralign(t1,t2,'0');
//printf("$1-:%s\n$2-:%s\n",t1,t2);
strpre(t1,9);
while(1)
{
stracc(t1);
while(*p=='0') { p++;}
printf("%s\n",p);
p=&t1[0];
if(t1[5]>'0') break;
}
//stracc(t1);
//for(int i=0;i<256;i++) printf("i=%3d",i,t1[i]);
//printf("%s\n",t1);
printf("\n");
return 0;
}