Advertisement
DidiMilikina

05. Rocket

Oct 15th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.06 KB | None | 0 0
  1. //URL FOR THE TASK: https://judge.softuni.bg/Contests/Practice/Index/359#4
  2.  
  3.  
  4. #include <iostream>
  5. #include <string>
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     int number;
  11.     cin >> number;
  12.  
  13.     int width = 3 * number;
  14.     int points_first_loop = (width - 2) / 2;
  15.     int spaces = 0;
  16.     for (int i = 0; i < number; ++i)
  17.     {
  18.         cout << string(points_first_loop, '.')
  19.             << '/'
  20.             << string(spaces, ' ')
  21.             << '\\'
  22.             << string(points_first_loop, '.')
  23.             << endl;
  24.         points_first_loop--;
  25.         spaces += 2;
  26.     }
  27.  
  28.     int points = number / 2;
  29.     cout << string(points, '.')
  30.         << string(2 * number, '*')
  31.         << string(points, '.')
  32.         << endl;
  33.  
  34.     for (int i = 0; i < 2 * number; ++i)
  35.     {
  36.         cout << string(points, '.')
  37.             << '|'
  38.             << string(2 * number - 2, '\\')
  39.             << '|'
  40.             << string(points, '.')
  41.             << endl;
  42.     }
  43.  
  44.  
  45.     int stars_third_loop = 2 * number - 2;
  46.     for (int i = 0; i < number / 2; ++i)
  47.     {
  48.         cout << string(points, '.')
  49.             << '/'
  50.             << string(stars_third_loop, '*')
  51.             << '\\'
  52.             << string(points, '.')
  53.             << endl;
  54.         points--;
  55.         stars_third_loop += 2;
  56.     }
  57.  
  58.     return 0;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement