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++)
精彩评论