开发者

Static sized combinations

Hour upon hour and I cannot come up with a solution.

Let's say I have ABC, I need all it's 3 letter combinations, a开发者_如何学编程bc, bbc, cbc etc. Not a ab abc etc. Can it be done with just loops? no recursion or methods?


for (char ch1 = 'A'; ch1 <= 'C'; ch1++)
    for (char ch2 = 'A'; ch2 <= 'C'; ch2++)
       for (char ch3 = 'A'; ch3 <= 'C'; ch3++)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜