Simple run-length encoding of a ascii picture.

On 2010-9-1 3:49, Albert wrote:
#include<stdio.h>
main()
{
int a,b,c;
int count = 1;
for (b=c=10;a="- FIGURE?, UMKC,XYZHello Folks,\
TFy!QJu ROo TNn(ROo)SLq SLq ULo+\
UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^\
NBELPeHBFHT}TnALVlBLOFAkHFOuFETp\
HCStHAUFAgcEAelclcn^r^r\\tZvYxXy\
T|S~Pn SPm SOn TNn ULo0ULo#ULo-W\
Hq!WFs XDt!" [b+++21]; )
This is the encoding of the picture, each charactor ch > 64 (from the 32nd byte, ie. the second row)
represent the length of a sequence of '!' or ' '. (len = ch - 64)

for(; a-->  64 ; )
putchar ( ++c=='Z' ? c = c/ 9:33^b&1);
print a sequence of '!' (if b is even) or ' '(if b is odd) with length (a-64), beginning with sequence of ' ' (b=11),
and alternatively output sequence of '!' and sequence of ' '.

c controls the line wrap by increase from 10 to 90, then rewind to 10 and output a linefeed,
so exactly 80 bytes on each line.

return 0;
}

It just contains two for loop but i cant understand the how it is
working???

help me please.........


--
You received this message because you are subscribed to the Google Groups "Algorithm 
Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to