this is what i am trying to do.
take any number x. and output the following up to x numbers
1
--2
----3
------4
--------5
------4
----3
--2
1
i split it in to two for loops from the top to the 5
#include <iostream>
#include <iomanip>
int input;
cout <<"please input value to be calculated; " <<endl;
cin >>input:
for (int i = 1; i <= input; i++)
{
cout <<i <<endl;
for (int j = 1; j <= i; j++)
cout <<setw(3 * j);
}
this displays
1
--2
----3
------4
--------5
but, can't figure out how to display
------4
----3
--2
1
please help
take any number x. and output the following up to x numbers
1
--2
----3
------4
--------5
------4
----3
--2
1
i split it in to two for loops from the top to the 5
#include <iostream>
#include <iomanip>
int input;
cout <<"please input value to be calculated; " <<endl;
cin >>input:
for (int i = 1; i <= input; i++)
{
cout <<i <<endl;
for (int j = 1; j <= i; j++)
cout <<setw(3 * j);
}
this displays
1
--2
----3
------4
--------5
but, can't figure out how to display
------4
----3
--2
1
please help