Thread: All possible combinations for any number of digits and characters

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Sep 2010
    Location
    Boston, MA
    Posts
    97

    All possible combinations for any number of digits and characters

    Hey, I have a lab assignment for school in which I have to write a recursive c or c++ function that will send every possible combination of a group of letters and any number of digits to a file.
    For example: 5 Chars - 3 Digits would have to look like

    Code:
    A
    B
    C
    D
    E
    AA
    AB
    AC
    AD
    AE
    BA
    BB
    BC
    BD
    BE
    CA
    CB
    CC
    CD
    CE
    DA
    DB
    DC
    DD
    DE
    EA
    EB
    EC
    ED
    EE
    AAA
    AAB
    AAC
    ...
    EEE
    I've spent a long time thinking about it and don't know how I should do it, whether it be linked lists with recursion or objects oriented. Any thoughts would be great.
    Last edited by omGeeK; 03-17-2012 at 01:33 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A3K4 << how many alpha characters and sum of digits?
    By scatterbrain in forum C Programming
    Replies: 3
    Last Post: 12-01-2011, 03:15 PM
  2. Generating number combinations
    By litzkrieg in forum C Programming
    Replies: 23
    Last Post: 03-01-2011, 11:25 AM
  3. Number of digits in a decimal number
    By maverix in forum C Programming
    Replies: 7
    Last Post: 11-04-2007, 12:12 PM
  4. computing the number of combinations
    By clover in forum C Programming
    Replies: 34
    Last Post: 06-06-2004, 01:12 PM
  5. Replies: 10
    Last Post: 01-07-2002, 04:03 PM