Print EAN13 Barcodes by bk1e

char s[99],r[]="'3\e!\0359\005\021\t\027",p[]="\0004,\0342&\016*\032\026",c,d,f,h,i,j;a(){printf("%4d   ",d);}b(e,g){for(j=0;j<7;++j)putchar(e&1<<(g?6-j:j)?35:32);}main(z){for(;gets(s);)for(h=0;h<11;++h){f=h==10;c=*s-48;printf("%c # #",f?*s:32);z=h?z:c;
for(i=0;i<6;++i){d=s[i+2]-48;z+=h?0:d*(i%2?1:3);f?a():p[c]&1<<i?b(r[d],1):b(~r[d],0);}printf(" # # ");
for(i=0;i<6;++i){if(i==5)d=(10-z%10)%10;else{d=s[i+9]-48;z+=h?0:d*(i%2?1:3);}f?a():b(r[d],0);}printf("# #%s\n",f?" >\n":"");}}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page