Assignment Chef icon Assignment Chef

[SOLVED] Cs150 – lab 18

5.0 1 customer review Digital download

Digital download

$25.00

Availability
In stock
Checkout
One item

Need a hand?

Message us on WhatsApp for payment or download support.

WhatsApp QR code

Write a function called treeTop that prints the top of a tree. It should take no parameters and return void. Write a second function called treeTrunk that prints the trunk of a tree. It should take one integer as a parameter for height (how many lines tall the trunk is), and also have a return type of void. Finally, create a function called drawTrees that takes two integer parameters, one for height and one for the number of trees to draw. drawTrees should use treeTop and treeTrunk.
Have the user enter the height of the trees (same for all) and number of trees to draw.
Note: The backslash symbol is used for certain special characters in strings in C++, such as (new line) and (tab), as such, to actually draw a single backslash you need two consecutive backslashes in your string.
Test cases:
Test case 1:
Enter tree height: <2>
Enter number of trees: <3>
^
/ /
/____
| |
| |
^
/ /
/____
| |
| |
^
/ /
/____
| |
| |
Test case 2:
Enter tree height: <5>
Enter number of trees: <1>
^
/ /
/____
| |
| |
| |
| |
| |