Advertisement
DidiMilikina

Untitled

Nov 4th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.33 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 = 2 * number - 1;
  11.     int height = number / 2 + 4;
  12.  
  13.     cout << "@";
  14.     cout << string(width / 2 - 1, ' ');
  15.     cout << "@";
  16.     cout << string(width / 2 - 1, ' ');
  17.     cout << "@" << endl;
  18.  
  19.     cout << "**";
  20.     cout << string(width / 2 - 2, ' ');
  21.     cout << "*";
  22.     cout << string(width / 2 - 2, ' ');
  23.     cout << "**" << endl;
  24.  
  25.     int spaces = number - 5;
  26.  
  27.     int middle = 1;
  28.     for (int i = 1; i <= number / 2 - 2; i++)
  29.     {
  30.         cout << "*";
  31.         cout << string(i, '.');
  32.         cout << "*";
  33.         cout << string(spaces, ' ');
  34.         cout << "*";
  35.         cout << string(middle, '.');
  36.         cout << "*";
  37.         cout << string(spaces, ' ');
  38.         cout << "*";
  39.         cout << string(i, '.');
  40.         cout << "*" << endl;
  41.         spaces -= 2;
  42.         middle += 2;
  43.     }
  44.  
  45.     int firstPoints = number / 2 - 1;
  46.     cout << "*";
  47.     cout << string(firstPoints, '.');
  48.     cout << "*";
  49.     cout << string(width - (2 * firstPoints + 4), '.');
  50.     cout << "*";
  51.     cout << string(firstPoints, '.');
  52.     cout << "*" << endl;
  53.  
  54.  
  55.     cout << "*";
  56.     cout << string(number / 2, '.');
  57.     cout << string((number - 4) / 2, '*');
  58.     cout << '.';
  59.     cout << string((number - 4) / 2, '*');
  60.     cout << string(number / 2, '.');
  61.     cout << "*" << endl;
  62.  
  63.     for (int i = 0; i < 2; i++)
  64.     {
  65.         cout << string(width, '*') << endl;
  66.     }
  67.  
  68.     return 0;
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement