I'm suppose to do a little program that asks for the height and draw a simple tree.
Problem
1 - Promt and read the height
2 - Test for height in bounds
3 - draw the base
4 - draw the trunk
5 - draw the cone
Here is my source code:
#include <iostream>
using namespace std;
int main()
{
int height;
cout << "Please enter a height for the pyramid: ";
cin >> height;
if (height < 3)
{
cout << "This height can't be calculated.\nPlease enter a number between 3 and 15. Thank you. ";
exit(0);
}
else if (height > 15)
{
cout << "This height can't be calculated.\nPlease enter a number between 3 and 15. Thank you. ";
exit(0);
}
for (int level = 0; level < height; level++)
{
for (int spaces = 0; spaces < height -1 - level; spaces++)
cout << ' ';
for (int b1 = 0; b1 < 2 - 1; b1++)
cout << '/';
cout << endl;
}
return 0;
}
So I just need to know how to do the other side of the tree with '\'.. I got the spaces already and the left side of the tree, but I cant figure out how to get the right side and the base.
Thank you very very much,
Doug