Jan 20, 2010 at 3:35pm UTC
can anyone please help me in understanding the equilateral triangle program? a few examples would be nice...
Jan 20, 2010 at 3:52pm UTC
What is the c++ equilateral triangle program?
Jan 20, 2010 at 4:01pm UTC
all sides should have a 60 degree angle...a pyramid perhaps
Jan 20, 2010 at 4:04pm UTC
What exactly are you doing and what are you referring to?
Jan 20, 2010 at 4:08pm UTC
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........
Jan 20, 2010 at 4:34pm UTC
yea but i'm having trouble printing the spaces
Jan 20, 2010 at 4:38pm UTC
What code do you have so far?
Jan 20, 2010 at 4:42pm UTC
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;
}