I'm trying to put together this program that creates a for loop but my end result is not positioned the way I need it like this but flipped around so it looks like a christmas tree effect.
*
**
***
****
*****
Please help I'm still learning and I can't figure it out for the life of me!
Source code:
#include <iostream>
using namespace std;
int main()
{
int i, j, lines;
cout << "This Program creates Christmas Trees." << endl;
do
{
cout << "Please enter a number between 1 and 30" << endl;
cin >> lines;
}while (lines < 1 || lines > 30);
for(j=1; j<=lines; j++)
{
for(i=1; i<=40; i=i++)
{
cout << " ";
}
for(i=1; i<=j; i=i++)
{
cout << "*";
}
cout << endl;
}
}