Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

/prog/ Challenge #9002

Name: Anonymous 2011-05-02 20:12

The task:

Print strings from "a" to "zzzzz" without using any loop or conditional statements. Don't just write all 1000 permutations out by hand. The output should look like this:
a
b
c
...
aa
ab
ac
...
zzzzx
zzzzy
zzzzz


inb4 lipthfags and dead dogs using some obscure functionality of their obscure languages.

Name: Anonymous 2011-05-03 4:40

ENTERPRISE QUALITY
it's not reaching the end, though...
at least i'm not using preprocessor tricks or some fag language

#include <stdio.h>

char c0 = 0, c1 = -1, c2 = -1, c3 = -1, c4 = -1;

int main()
{
 start:
 printf("%c%c%c%c%c\n",
        (c4 + 'a') & ((c4 >= 0) * 255),
        (c3 + 'a') & ((c3 >= 0) * 255),
        (c2 + 'a') & ((c2 >= 0) * 255),
        (c1 + 'a') & ((c1 >= 0) * 255),
        (c0 + 'a'));
 c0++;
 c1 += c0 > 25;
 c2 += c1 > 25;
 c3 += c2 > 25;
 c4 += c3 > 25;
 c0 %= 26;
 c1 %= 26;
 c2 %= 26;
 c3 %= 26;
 c4 %= 26;
 goto start;
 /* never reached... :-{ */
 printf("DONE!!\n");
 return 0;
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List