Larger number: N, smaller number: K

Task:to choose k from N and save the results of all such possible combinations for each k in suitable container(s) that can be acccessed (directly or through pointers)Code:for (k = 1; k <= K; k++)

What I have so far: code (thanks Google) to generate each of these combinations for 1 through K and, I think, a way of capturing each particular combination for each k in a vector

Outstandings, etc: (a) how to do a make_tuple() with the elements of this vector directly (assuming tuple is the best container to save each particular result?) (b) how do I store and access these tuples (via pointers?) as the type of the tuple changes with k or do I need K containers (c) or maybe there is some other way of approaching this problem that I have overlooked?

Code that will work and output to console: #10958326 - Pastie

Code that will not produce any visible output because it has been edited and commented to show outstandings (a) and (b) from above:

Thanks, as always, for any help, suggestionsCode:#include <iostream> #include <algorithm> #include <string> #include<vector> #include<ctime> using namespace std; int main() { cout<<"Choose N: "; int N; cin>> N; cout<<"Choose K: "; int K; cin>>K; clock_t tStart = clock(); for (int j = 1; j <= K; j++) { string bitmask(j, 1); bitmask.resize(N, 0); do { vector<int> v{}; for (int i = 0; i < N; ++i) { if (bitmask[i]) v.emplace_back(i+1); } //make_tuple(v.begin(),v.end()) // doesn't work; //place tuple_size<j> in a container; // cout << "\n"; } while (prev_permutation(bitmask.begin(), bitmask.end())); //tuple_size<j> increases by 1 from next j loop ; } cout<<"Time taken: "<<(clock() - tStart)/CLOCKS_PER_SEC<<" secs\n"; }