Help with function

Hi im trying to output a Christmas tree when the user inputs the size of the tree. However my program only prints half of the tree like this:

Enter the size of the tree (4-20): 5

#
###
#####

1
2
3
4
5
6
7
8
9
void drawABranch(int& branchLine)			//draw one line of foliage
{
	for (int i = 0; i < branchLine * 2 - 1; i++) 
	{
		cout << LEAF;
	}
	cout << EOL;
	++branchLine;
}


Any help/advice given will be greatly appreciated thanks!
Last edited on
When you say "size of the tree", is that depth or width? If it is width, you have it right, just without the appropriate spacing.

  #
 ###
#####
its the depth of the tree, but the bottom 2 lines of the tree will be the tree trunk which I will use "!" for
So like this?

  #
 ###
#####
  !
  !
Yes it should look like that however it only displays half of the tree
Topic archived. No new replies allowed.