MartinPaunov

Untitled

Oct 8th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.06 KB | None | 0 0
  1. // BasicsExam17September2017.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <string>
  7.  
  8. using namespace std;
  9.  
  10. int main() {
  11.  
  12.     int n;
  13.     cin >> n;
  14.     int print_count = n;
  15.  
  16.     int width = 3 * n;
  17.     for (int i = 0; i < width; i++)
  18.     {
  19.        
  20.         if (i == width / 2)
  21.         {
  22.             cout << "x";
  23.         }
  24.         else
  25.         {
  26.             cout << '.';
  27.         }
  28.     }
  29.     cout << endl;
  30.     for (int i = 0; i < width; i++)
  31.     {
  32.  
  33.         if (i == width / 2)
  34.         {
  35.             cout << "x";
  36.         }
  37.         else if (i == ((width / 2) - 1))
  38.         {
  39.             cout << "/";
  40.         }
  41.         else if (i == ((width / 2) + 1))
  42.         {
  43.             cout << "\\";
  44.         }
  45.         else
  46.         {
  47.             cout << '.';
  48.         }
  49.     }
  50.     cout << endl;
  51.     for (int i = 0; i < width; i++)
  52.     {
  53.  
  54.         if (i == width / 2)
  55.         {
  56.             cout << "|";
  57.         }
  58.         else if (i == ((width / 2) - 1))
  59.         {
  60.             cout << "x";
  61.         }
  62.         else if (i == ((width / 2) + 1))
  63.         {
  64.             cout << "x";
  65.         }
  66.         else
  67.         {
  68.             cout << '.';
  69.         }
  70.     }
  71.     cout << endl;
  72.  
  73.     for (int i = (width - (2 * n + 1))/2; i > 0; i--)
  74.     {
  75.         cout << string(i, '.');
  76.         cout << string(print_count, 'x');
  77.         cout << "|";
  78.         cout << string(print_count, 'x');
  79.         cout << string(i, '.') << endl;
  80.         print_count++;
  81.     }
  82.     for (int i = 0; i < (width - (2 * n - 1)) / 2; i++)
  83.     {
  84.         cout << string(i, '.');
  85.         cout << string(print_count, 'x');
  86.         cout << "|";
  87.         cout << string(print_count, 'x');
  88.         cout << string(i, '.') << endl;
  89.         print_count--;
  90.     }
  91.     print_count = n;
  92.     for (int i = 0; i < width; i++)
  93.     {
  94.  
  95.         if (i == width / 2)
  96.         {
  97.             cout << "x";
  98.         }
  99.         else if (i == ((width / 2) - 1))
  100.         {
  101.             cout << "/";
  102.         }
  103.         else if (i == ((width / 2) + 1))
  104.         {
  105.             cout << "\\";
  106.         }
  107.         else
  108.         {
  109.             cout << '.';
  110.         }
  111.     }
  112.     cout << endl;
  113.     for (int i = 0; i < width; i++)
  114.     {
  115.  
  116.         if (i == width / 2)
  117.         {
  118.             cout << "x";
  119.         }
  120.         else if (i == ((width / 2) - 1))
  121.         {
  122.             cout << "\\";
  123.         }
  124.         else if (i == ((width / 2) + 1))
  125.         {
  126.             cout << "/";
  127.         }
  128.         else
  129.         {
  130.             cout << '.';
  131.         }
  132.     }
  133.     cout << endl;
  134.     for (int i = (width - (2 * n + 1)) / 2; i > 0; i--)
  135.     {
  136.         cout << string(i, '.');
  137.         cout << string(print_count, 'x');
  138.         cout << "|";
  139.         cout << string(print_count, 'x');
  140.         cout << string(i, '.') << endl;
  141.         print_count++;
  142.     }
  143.     for (int i = 0; i < (width - (2 * n - 1)) / 2; i++)
  144.     {
  145.         cout << string(i, '.');
  146.         cout << string(print_count, 'x');
  147.         cout << "|";
  148.         cout << string(print_count, 'x');
  149.         cout << string(i, '.') << endl;
  150.         print_count--;
  151.     }
  152.     for (int i = 0; i < width; i++)
  153.     {
  154.  
  155.         if (i == width / 2)
  156.         {
  157.             cout << "|";
  158.         }
  159.         else if (i == ((width / 2) - 1))
  160.         {
  161.             cout << "x";
  162.         }
  163.         else if (i == ((width / 2) + 1))
  164.         {
  165.             cout << "x";
  166.         }
  167.         else
  168.         {
  169.             cout << '.';
  170.         }
  171.     }
  172.     cout << endl;
  173.     for (int i = 0; i < width; i++)
  174.     {
  175.  
  176.         if (i == width / 2)
  177.         {
  178.             cout << "x";
  179.         }
  180.         else if (i == ((width / 2) - 1))
  181.         {
  182.             cout << "\\";
  183.         }
  184.         else if (i == ((width / 2) + 1))
  185.         {
  186.             cout << "/";
  187.         }
  188.         else
  189.         {
  190.             cout << '.';
  191.         }
  192.     }
  193.     cout << endl;
  194.     for (int i = 0; i < width; i++)
  195.     {
  196.  
  197.         if (i == width / 2)
  198.         {
  199.             cout << "x";
  200.         }
  201.         else
  202.         {
  203.             cout << '.';
  204.         }
  205.     }
  206.     cout << endl;
  207. }
Advertisement
Add Comment
Please, Sign In to add comment