Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- void printLoop(int n, char c){
- for(int i = 1; i <= n; ++i){
- printf("%c", c);
- }
- }
- int main(){
- int n;
- scanf("%d", &n);
- // Top
- printLoop(4 + n, ' ');
- cout << "|\n";
- printLoop(2 + n, ' ');
- cout << "__*__\n";
- printLoop(3 + n, ' ');
- cout << "/|\\\n";
- printLoop(2 + n, ' ');
- cout << "/* *\\\n";
- // Leaves
- int stBlank = n + 1;
- int stNum = 2;
- for(int l = 1; l <= n; ++l){
- int blank = stBlank;
- int num = stNum;
- for(int i = 1; i <= 3; ++i){
- printLoop(blank, ' ');
- cout << "/*";
- for(int j = 1; j <= num; ++j){
- cout << " *";
- }
- cout << "\\\n";
- --blank;
- ++num;
- }
- --stBlank;
- ++stNum;
- }
- // Stem
- printLoop(3 + n, ' ');
- cout << "|||\n";
- printLoop(3 + n, '_');
- cout << "|||";
- printLoop(3 + n, '_');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement