I'm practicing programming by doing a little lotto calculator to compute lotto designs. In C++, how can I make a list that contains all different lotto rows i.e. seven numbers from the set {1,2,...,39}? Name, I'm hoping to find an algorithm to automatize the following:
list<int> L;
L.push_front(1);
L.push_front(2);
L.push_front(3);
L.push_front(4);
L.push_front(5);
L.push_front(6);
L.push_front(7);
L.push_front(1);
L.push_front(2);
L.push_front(3);
L.push_front(4);
L.push_front(5);
L.push_front(6);
L.push_front(8);
...
L.push_front(33);
L.push_front(34);
L.push_front(35);
L.push_front(36);
L.push_front(37);
L.push_front(38);
L.push_front(39);
I thought that a recursion might work to generate all combinations, in pseudocode like K({1,2,...,39},7)=(1,K({2,3,...,39},6)) union (2,K({1,3,...,39},6)) but the problem is that functions can't return arrays in C++.