Advertisement
DidiMilikina

05. Rocket

Oct 15th, 2017
90
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.  
  17.     for (int i = 0; i < number; ++i)
  18.     {
  19.         cout << string(points_first_loop, '.')
  20.             << '/'
  21.             << string(spaces, ' ')
  22.             << '\\'
  23.             << string(points_first_loop, '.')
  24.             << endl;
  25.         points_first_loop--;
  26.         spaces += 2;
  27.     }
  28.  
  29.     int points = number / 2;
  30.     cout << string(points, '.')
  31.         << string(2 * number, '*')
  32.         << string(points, '.')
  33.         << endl;
  34.  
  35.     for (int i = 0; i < 2 * number; ++i)
  36.     {
  37.         cout << string(points, '.')
  38.             << '|'
  39.             << string(2 * number - 2, '\\')
  40.             << '|'
  41.             << string(points, '.')
  42.             << endl;
  43.     }
  44.  
  45.  
  46.     int stars_third_loop = 2 * number - 2;
  47.     for (int i = 0; i < number / 2; ++i)
  48.     {
  49.         cout << string(points, '.')
  50.             << '/'
  51.             << string(stars_third_loop, '*')
  52.             << '\\'
  53.             << string(points, '.')
  54.             << endl;
  55.         points--;
  56.         stars_third_loop += 2;
  57.     }
  58.  
  59.     return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement