Thread: Not sure how to...

  1. #1
    Registered User
    Join Date
    Jun 2006
    Posts
    7

    Not sure how to...

    Hi,
    I am new to c++ and these forums,i want to make something but i can't figure out how..
    i know it involves loops.
    Basicly i want to output to a file every possible combination between aaa01 to zzz99 so somethings in between might be afv48 vhg92.
    im a little confused on how to do this..

  2. #2
    Registered User
    Join Date
    May 2006
    Location
    Berkshire, UK
    Posts
    29
    Hi - sounds like a fairly simple problem with a number of solutions of varying complexity and elegance (always important).

    You could go with (output to stdout, although you can always change it to a file):
    Code:
    for(char i='a'; i<='z'; i++)
     for(char j='a'; j<='z'; j++)
       for(char k='a'; k<='z'; k++)
         for(int n=0;n<=99;n++)
            std::cout<< i <<  j << k << n/10 << n%10 << std::endl;
    Hope this helps as a start...
    Why do you want to do this though? (just curious)
    Michael
    Last edited by michaels-r; 06-19-2006 at 04:51 AM.

Popular pages Recent additions subscribe to a feed