In my opinion it is a too difficult assignment for a beginner.
Of course it can be done simply with using stream manipulators as for example std::setw and std::right. And I did it the way I have described. For example
1 2 3 4 5 6 7
Enter a positive number: 3
*
* *
* *
* *
*
or
1 2 3 4 5 6 7 8 9
Enter a positive number: 4
*
* *
* *
* *
* *
* *
*
But I would advice a beginner to use a character array or an object of type std::string of the fixed size and output it in a loop.
Look this thread
http://www.cplusplus.com/forum/beginner/86158/
Though the ouput is
1 2 3 4 5 6 7
*
***
*****
*******
*****
***
*
but the author uses an interesting idea that I did not even take into account early. If you will study his code you can adopt it to your task that to get the output