Bojo96

05.Sheriff

Oct 14th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.67 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int size;
  8.     cin >> size;
  9.  
  10.     int number_of_cols = 3 * size;
  11.     int number_of_dots = (number_of_cols - 1) / 2;
  12.  
  13. #pragma region Head
  14.     cout << string(number_of_dots, '.')
  15.         << "x"
  16.         << string(number_of_dots, '.')
  17.         << endl;
  18.     number_of_dots--;
  19.     cout << string(number_of_dots, '.')
  20.         << "/x\\"
  21.         << string(number_of_dots, '.')
  22.         << endl;
  23.     cout << string(number_of_dots, '.')
  24.         << "x|x"
  25.         << string(number_of_dots, '.')
  26.         << endl;
  27. #pragma endregion
  28.  
  29. #pragma region Upper Body
  30.     int number_of_exes = size;
  31.     //First Half of upper body
  32.     for (int i = 0; i <= size / 2; i++)
  33.     {
  34.         int number_of_dots = (number_of_cols - 1 - 2 * number_of_exes) / 2;
  35.  
  36.         cout << string(number_of_dots, '.')
  37.             << string(number_of_exes, 'x')
  38.             << "|"
  39.             << string(number_of_exes, 'x')
  40.             << string(number_of_dots, '.')
  41.             << endl;
  42.  
  43.         number_of_exes++;
  44.     }
  45.  
  46.     number_of_exes = (number_of_cols - 3) / 2;
  47.  
  48.     //Second half of upper body
  49.     for (int i = size / 2; i > 0; i--)
  50.     {
  51.         int number_of_dots = (number_of_cols - 1 - 2 * number_of_exes) / 2;
  52.  
  53.         cout << string(number_of_dots, '.')
  54.             << string(number_of_exes, 'x')
  55.             << "|"
  56.             << string(number_of_exes, 'x')
  57.             << string(number_of_dots, '.')
  58.             << endl;
  59.  
  60.         number_of_exes--;
  61.     }
  62. #pragma endregion
  63.  
  64. #pragma region Middle
  65.     cout << string(number_of_dots, '.')
  66.         << "/x\\"
  67.         << string(number_of_dots, '.')
  68.         << endl;
  69.     cout << string(number_of_dots, '.')
  70.         << "\\x/"
  71.         << string(number_of_dots, '.')
  72.         << endl;
  73. #pragma endregion
  74.  
  75. #pragma region Lower Body
  76.     number_of_exes = size;
  77.     //First Half of upper body
  78.     for (int i = 0; i <= size / 2; i++)
  79.     {
  80.         int number_of_dots = (number_of_cols - 1 - 2 * number_of_exes) / 2;
  81.  
  82.         cout << string(number_of_dots, '.')
  83.             << string(number_of_exes, 'x')
  84.             << "|"
  85.             << string(number_of_exes, 'x')
  86.             << string(number_of_dots, '.')
  87.             << endl;
  88.  
  89.         number_of_exes++;
  90.     }
  91.  
  92.     number_of_exes -= 2;
  93.  
  94.     //Second half of upper body
  95.     for (int i = size / 2; i > 0; i--)
  96.     {
  97.         int number_of_dots = (number_of_cols - 1 - 2 * number_of_exes) / 2;
  98.  
  99.         cout << string(number_of_dots, '.')
  100.             << string(number_of_exes, 'x')
  101.             << "|"
  102.             << string(number_of_exes, 'x')
  103.             << string(number_of_dots, '.')
  104.             << endl;
  105.  
  106.         number_of_exes--;
  107.     }
  108. #pragma endregion
  109.  
  110. #pragma region Footer
  111.     cout << string(number_of_dots, '.')
  112.         << "x|x"
  113.         << string(number_of_dots, '.')
  114.         << endl;
  115.  
  116.     cout << string(number_of_dots, '.')
  117.         << "\\x/"
  118.         << string(number_of_dots, '.')
  119.         << endl;
  120.  
  121.     number_of_dots++;
  122.     cout << string(number_of_dots, '.')
  123.         << "x"
  124.         << string(number_of_dots, '.')
  125.         << endl;
  126. #pragma endregion
  127.  
  128.     return 0;
  129. }
Advertisement
Add Comment
Please, Sign In to add comment