need some help in a program
hi, i need some help in a program which has to be in C++ languge: the program is to draw a pyramid of stats (*), only the front of it that the user will input the number of lines of the stars. how do i wright the sentix of such a program!!!
[240 byte] By [
Kasseba] at [2007-11-11 8:03:44]

# 1 Re: need some help in a program
This is an optional solution:
#include <iostream>
using namespace std;
int main()
{
int row;
int startrow;
int num;
int counter;
cout << "Give the number of rows of the pyramid:" << endl;
cin >> row;
counter = 1;
for(startrow = row; row>0;--row)
{
//Drawing blancs
for(num=startrow-counter;num>0;num--)
{
cout << " " ;
}
//Drawing stars
for(num=(counter*2)-1; num > 0;num--)
{
cout << "*";
}
cout << endl;
counter++;
}
return 0;
}
Hope this helps.
Benjamin