I am trying to center the triangle, but I have no idea how.
I am trying to make a triangle like below:
*
***
****
******
(this is not the one I want, the format screws up)
I kind of forgot, do i use something like printf?
#include <iostream.h>
#include <conio.h>
main()
{
int height;
int i = 1;
cout << "height?";
cin >> height;
while(i<=height)
{
for(int j=0; j<i; j++)
{
cout << "*";
}
cout << endl;
i=i+2;
}
/*
i = height - 2;
while(i>=1)
{
for(int j=0;j<i;j++)
{
cout << "*";
}
cout << endl;
i = i - 2;
} */
getch();
}