Vulnerability Development mailing list archives

Re: combinations of 4


From: nonme <stf () xtra co nz>
Date: Mon, 08 Apr 2002 17:34:12 +1200

At 01:43 p.m. 7/04/02 -0700, jon schatz wrote:
On Sat, 2002-04-06 at 17:01, KF wrote:
My question is does anyone know how to programatically do this? Do i 
need to make use of bit shifting or something? I need only a program to 
print the list to the screen or something simple. Example output would 
be ...

AAAA
BBBBB
....
AAAB
AAAC

perl -e 'foreach (AAAA..ZZZZ) { print $_,"\n";}'

i'm sure someone on this list can golf this down, but this should be
sufficient...

Well Jon, I think you win the prize ;-)

I can't even come close to that in C and i'm sure someone can out do my
feeble attempt.

int main()
{
    int a,b,c,d;
    for ( a=65; a < 91; a++) {
        for ( b=65; b < 91; b++) {
            for ( c=65; c < 91; c++) {
                for ( d=65; d < 91; d++)  {
                    printf("%c%c%c%c\n",a,b,c,d);
                }
            }
        }
    }
}

Have fun,
Harm none.

- nonme


Current thread: