You need two nested loops, not just one. The first loop counts from 0 to num then the inner loop counts from 0 to the value of the outer loop, something like this
for(int i = 0; i < num; i++)
{
for( int j = 0; j <= i; j++)
{
}
}
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
You could just use a simple while loop.
while(true)
{
cout << "Enter a positive integer between 0 and 1000: \n";
// rest of code goes here
}
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343