I need to look like this
.....1
....1 2
...1 2 3
..1 2 3 4
.1 2 3 4 5
The output from this code look like this
1
12
123
1234
12345
I am trying to use setw but the only thing that I output is the first number out the marging.
1
12
123
1234
12345
Any ideas??
This is my code so far.
#include <iostream>
#include <iomanip>
using namespace std;
const int Success = 0;
int numberss = 5; //const number to change for a dinamic arrays.
// the next part is to make the user said to how number do you want the tree.
int main()
{
int i, j; // logical variables
for(i = 1; i <= numberss; i++) // loop i to 5,
{
for(j = 1; j <= i; j++) // loop to count
cout << j << " "; // output the numbers
cout << endl; // next line output.
}
system("pause");
return Success;
}//end of main.
*mod edit: added code tags
helped with formatting for output
This post has been edited by NickDMax: 24 October 2008 - 04:45 PM

New Topic/Question
Reply




MultiQuote






|