Combinations
I have a string array with 16 elements (A01,A02,A03,...,A14,A15,A16) and i would like to create a new string array which wil contais all of the combinations with 8 elements of this array. I need a code on how to complete this task.

Re: Combinations
Refer to All possible combinations of a string article.

Re: Combinations
This code is Ok but i do not need all of combinations and permutations. I need only the combiations and I would like the new array contains combination like this :
A01A02A03A04A05A06A07A08 A01A02A03A04A05A06A07A09 A01A02A03A04A05A06A07A10 A01A02A03A04A05A06A07A11 . . . . . . . . . . . . . . . . . . . . . . . . . . A09A10A11A12A13A14A15A16 I hope you understand what i mean. 
Re: Combinations
You treat an element as A01 and not as 3 seperate characters and apply thew above logic to get the combination.
Say I identify A01 as X A02 as Y .... and then apply the above all combination to XY... and then resubstitute them when needed. 
Re: Combinations
My problem is not the string A01 or A02, my problem is that i need only the combinations like this:
A01A02A03A04A05A06A07A08 A01A02A03A04A05A06A07A09 . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . A09A10A11A12A13A14A15A16 And the program create combinations like this : A01A02A03A04A05A06A07A08 A02A01A03A04A08A06A07A09 . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . A16A10A11A12A13A14A15A09 If i have 8 of 16 combinations the new array must have 12870 combinatiosn not more. I hope you understand what i mean now. 
Re: Combinations
Yes I got your point and you can decrease the amount of looping and get your problem solved.
In that thread I have commented the complete source code and so that should help you more. http://www.go4expert.com/showthread.php?p=3161 
Re: Combinations
I do not uderstand what should I change in this code to complete my goal.
I will try to explain better what i would like to do. I will explain problem with smaller number of elements because 16 is too large to write all combinations. Let say I have array with 6 elements {A,B,C,D,E,F}. Now i need to find combinations 4 of 6. There are 15 combinations of 4 letters from this set ( n!/(r!(nr)!)=6!/(2!(62)!)=15 ) and they are : A B C D A B C E A B C F A B D E A B D F A B E F A C D E A C D F A C E F A D E F B C D E B C D F B C E F B D E F C D E F What should I change in you code to have this. Maybe I can not explain good becouse English is not my mother language. 
Re: Combinations
Just edit the following.
change to the required word. Code: C
Code: C
Code: C

Re: Combinations
When i apply this changes to code I still don`t have combinations as I write in the previous message.
Here are the combinations created with new code : ABCD ABCD BCDE BCDE CDEF CDFE DEFA DEFA EFAB EFAB FABC FABC ABCD ABCD I will try to explayin again my problem detailed. I need to enter two variables (not larger then 20) N and R (N must be larger then R). for example N=6, R=4. I create an CString array strArray with N (6) elements strArray[0] = "A01" . . . . . . . . . . . . . . . . . . . . strArray[5] = "A06" Now I need to create all combinations with R (4) elements of this array and store them in some new array. 
Re: Combinations
Quote:

All times are GMT +5.5. The time now is 08:45. 