The task can be solved easily if you look at how you would write it down as a human.
It is best to solve it in such a way that it also works for longer outputs.
1
2 1
3 2 1
4 3 2 1
4 3 2
4 3
4
Obviously, the longest line is N characters long. Here N=4.
Now you can program a loop, which always writes a digit in front.
Since a solution with C++ is looked for, one can use here well a std::string.
The loop is run from 1 to N and in each run the loop index is written in front.
Now the string can simply be output with a newline at the end.
We will not program this for you, because it is your task and not ours.