hi everyone,
I was trying to output all the r-combinations of n such that if the user inputs n{1,3,6,2,9} and the r is 3 the output would be like this
1 3 6
1 3 2
1 3 9
3 6 2
3 6 9
6 2 9
i tried to do it with recursion but all i get was an infinite output....
then i tried also with functions but the output is this:
1 1
1 3
1 6
1 9
1 2
1
3 3
3 1
3 6
3 9
3 2
3
. . . .
2 2
2 1
2 3
2 6
2 9
2
anything would be a great help... i'm still a beginner at c/c++ programming that's why i'm having difficulties with these kinds of programs....
I was trying to output all the r-combinations of n such that if the user inputs n{1,3,6,2,9} and the r is 3 the output would be like this
1 3 6
1 3 2
1 3 9
3 6 2
3 6 9
6 2 9
i tried to do it with recursion but all i get was an infinite output....
then i tried also with functions but the output is this:
1 1
1 3
1 6
1 9
1 2
1
3 3
3 1
3 6
3 9
3 2
3
. . . .
2 2
2 1
2 3
2 6
2 9
2
anything would be a great help... i'm still a beginner at c/c++ programming that's why i'm having difficulties with these kinds of programs....
Comment