Are you going to have a go at proposing an algorithm?
From your list you can see
1 is followed by 1, 2
and
1,1 is followed by 1, 2, 3
1,2 is followed by 2, 3
A solution for the cases N=2 and N=3 should be (is!) relatively straightforward. Then you could have a go coding that. After which you can generalise it for any N, which is a bit (rather?) more involved.
input (N): 4
(That means we have four columns for the digits.)
(One column can have digits from 1 to 4.)
output list (without conditions):
1,1,1,1
1,1,1,2
1,1,1,3
1,1,1,4
1,1,2,1
1,1,2,2
1,1,2,3
1,1,2,4
1,1,3,1
1,1,3,2
1,1,3,3
1,1,3,4
...
4,4,4,3
4,4,4,4
BUT there are also other conditions which I have to follow:
1. condition
first column can have only one digit: 1
second column can have only two digits: 1 or 2
third column can have only three digits: 1,2 or 3
fourth column can have only four digits: 1,2,3 or 4
and so on
1,1,1,1
1,1,1,2
1,1,1,3
1,1,1,4
1,1,2,1
1,1,2,2
1,1,2,3
1,1,2,4
1,1,3,1
1,1,3,2
1,1,3,3
1,1,3,4
1,2,1,1
1,2,1,2
1,2,1,3
1,2,1,4
1,2,2,1
1,2,2,2
1,2,2,3
1,2,2,4
1,2,3,1
1,2,3,2
1,2,3,3
1,2,3,4
2. condition:
previous element <= current element <= next element (looking only at one line)
So when both condition fulfilled we get this list (if input was N=4):
1,1,1,1
1,1,1,2
1,1,1,3
1,1,1,4
1,1,2,1 <-- bad (1<=1<=2>1) (not element of this list)
1,1,2,2 <-- right (1<=1<=2<=2)
1,1,2,3 <-- right (1<=1<=2<=3)
1,1,2,4 <-- right (1<=1<=2<=4)
I would focus on the starting and termination conditions for each member of the sequence.
I coded the N=2 (with a single for-loop and one cout) and the N=3 case (with two for for-loops and one cout) easily enough. The N=4, 5, 6, ... can be seen to follow. The only "trick" is working out when to start and stop each loop!
And at first glance, I would say that iteration will be required to implement the general case cleanly (all iterative solution can be converted to loops, but not always in a friendly way...)
Now, modify this to incorporate the second condition:
previous element <= current element <= next element
Hint: You would need to add an extra parameter to the generate function.