Hi there,
I have fallen, as has often been said, in the problem that I can't to solve elegantly. I should make a program that generates from the Y elements a sequences of X members without repetition. I know how to get numbers of such series (for sequence 4 of 6 there is 15 possible cases...)
I made it simply by using nested few FOR...NEXT statements
but in my case there are some situation where I don't know for sure number of elements and "class", so I can't presume and use above way. Is there some way where I could input number of elements at all (6) and number of elements in each sequence (4) in order to meet my needs? I heard about recursion programming but I didn't saw some example.
Thank you.
There is no good nor evil, just decisions and consequences.
I have fallen, as has often been said, in the problem that I can't to solve elegantly. I should make a program that generates from the Y elements a sequences of X members without repetition. I know how to get numbers of such series (for sequence 4 of 6 there is 15 possible cases...)
I made it simply by using nested few FOR...NEXT statements
Code:
*1 2 3 4
*1 2 3 5
*1 2 3 6
*1 2 4 5
*1 2 4 6
*1 3 4 5
...
*3 4 5 6
* 4 of 6
bel=6 && number of elements at all
raz=4 && how much elements in each sequence (class)
*----
FOR a= 1 TO bel
FOR b=a+1 TO bel
FOR c=b+1 TO bel
FOR d=c+1 TO bel
? a,b,c,d
NEXT d
NEXT c
NEXT b
NEXT a
Thank you.
There is no good nor evil, just decisions and consequences.