Strings Generation

Posted by sikas on Stack Overflow See other posts from Stack Overflow or by sikas
Published on 2010-05-23T14:58:10Z Indexed on 2010/05/23 15:10 UTC
Read the original article Hit count: 274

Filed under:
|

Hi,I would like to know how can I create various string from some given characters eg:

given characters: a, b

I would like to generate the following strings:

aa
ab
ba
bb

What I have thought of is having (for 2 inputs only) two for-loops one inside another, and then loop each to the number of inputs which in this case is 2 and the output strings will be 2*2 = 4 strings and as the number increases the number of output strings will increase by multiplying n*n (n-times)

© Stack Overflow or respective owner

Related posts about c++

Related posts about permutation