Re: combinations of 4

From: nonme (stf@xtra.co.nz)
Date: Mon Apr 08 2002 - 01:34:12 EDT


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



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:28:03 EDT