Hi, I have this program that outputs a triangle when given the size.
Right now the triangle outputs like this

5
*
**
***
****
*****

Does anyone know how I would make it look like this?

5
1
12
123
1234
12345

Thanks in advanced for looking at my post.

#include<iostream>
using namespace std;
   

int main(){ 
     int num, row;
     cin>>num;
     for(row=0;row<num;row++)
     {
        for (int a=0; a<=row;a++)
        {
            cout<<"*";
            }
            for (int b=num;b>row+1;b--)
            cout<<" ";
            cout<<endl;
            }
            cin.ignore();
            cin.ignore();
            return 0;
            }

Hint:

Use

cout << a + 1

in the inner for loop.

Thanks. Would I have to change the whole code if I want to output it this way as well?

5
5
45
345
2345
12345

Not really,

for(row=num;row>0;row--)
for (int a=row-1; a<num;a++)

These will be your outer and inner loops.