trouble understanding the c++ equilateral triangle program

can anyone please help me in understanding the equilateral triangle program? a few examples would be nice...
What is the c++ equilateral triangle program?
all sides should have a 60 degree angle...a pyramid perhaps
What exactly are you doing and what are you referring to?
i want to write a c++ program to print an equilateral triangle of stars....this was a question given by my professor in my exam and i could not solve it........
Like this?
     *
    ***
   *****
  *******
 *********
***********

( you can't have a perfect equilateral triangle with stars )

You need for loops to do it
yea but i'm having trouble printing the spaces
What code do you have so far?
i got it..thnx for the help


#include<iostream>
using namespace std;

int main()
{


for(int i=0;i<6;i++)
{
for(int space=6-i;space>0;space--)cout<<" "; //defining spaces
cout<< "*" <<" ";
for(int col=1;col<i+1;col++)cout<<"*"<<" ";
cout<<endl;
}

cin.get();
return 0;
}
Topic archived. No new replies allowed.