Code: Select all
#include <iostream.h>
/*void draw(int endSpace, int beginSpace, int endStar, int initStar)
{
bool complete=false;
while(!complete)
{
for(int spaces=0;endSpace>spaces;spaces++)
{
cout<<" ";
}
endSpace-=1;
for(int stars=initStar;stars<endStar;stars++)
{
cout<<"*";
}
cout<<endl;
endStar+=2;
if(endSpace==beginSpace) complete=true;
}
}*/
void drawRow(int maxSpaces, int maxStars)
{
for(int spaces=0;spaces<maxSpaces;spaces++)
{
cout<<" ";//drawSpace();
}
for(int stars=0;stars<maxStars;stars++)
{
cout<<"*";//drawStar();
}
cout<<endl;//nextRow();
}
void drawTree(int maxSpaces, int maxStars, int draws)
{
int maxStar=maxStars;
for(int maxSpace=maxSpaces; maxSpace>=8;maxSpace--)
{
drawRow(maxSpace,maxStar);
maxStar+=2;
}
draws++;
if(draws>3)
{
return;
}
else
{
drawTree(maxSpaces-2,maxStars+4,draws);
}
}
/*
void drawNextSection()
{
int maxStars=6;
for(int maxSpaces=12; maxSpaces>6;maxSpaces--)
{
drawRow(maxSpaces,maxStars);
maxStars+=2;
}
}
void drawBottom()
{
int maxSpaces=12;
int maxStars=6;
for(int rows=0;rows<6;rows++)
{
drawRow(maxSpaces,maxStars);
}
}*/
void main(void)
{
int maxStars=1;
int maxSpaces=15;
int initDraws=1;
drawTree(maxSpaces,maxStars,initDraws);
/*for(int EndSpace=14;endSpace<=EndSpace;EndSpace-=2)
{
draw(endSpace,4,endStars,beginStars);
endStars+=2;
}*/
}