Advertisement
DidiMilikina

Problem 05. Christmas Hat

Oct 15th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7.     int number;
  8.     cin >> number;
  9.  
  10.     int width = 4 * number + 1;
  11.     int height = 2 * number + 5;
  12.  
  13.     cout << string(2 * number - 1, '.');
  14.     cout << "/";
  15.     cout << "|";
  16.     cout << "\\";
  17.     cout << string(2 * number - 1, '.') << endl;
  18.  
  19.     cout << string(2 * number - 1, '.');
  20.     cout << "\\";
  21.     cout << "|";
  22.     cout << "/";
  23.     cout << string(2 * number - 1, '.') << endl;
  24.  
  25.     int points = 2 * number - 1;
  26.     for (int i = 0; i <= 2 * number - 1; i++)
  27.     {
  28.         cout << string(points, '.');
  29.         cout << '*';
  30.         cout << string(i, '-');
  31.         cout << '*';
  32.         cout << string(i, '-');
  33.         cout << '*';
  34.         cout << string(points, '.') << endl;
  35.         points--;
  36.     }
  37.  
  38.     cout << string(width, '*') << endl;
  39.  
  40.     for (int i = 1; i <= width / 2; i++)
  41.     {
  42.         cout << "*.";
  43.     }
  44.     cout << '*' << endl;
  45.     cout << string(width, '*') << endl;
  46.  
  47.     return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement