Advertisement
Spocoman

Skyscraper

Sep 25th, 2023
501
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.19 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. string repeat(char s, int n) {
  6.     string result;
  7.  
  8.     for (int i = 0; i < n; i++)
  9.     {
  10.         result += s;
  11.     }
  12.     return result;
  13. }
  14.  
  15. int main() {
  16.     int n;
  17.     cin >> n;
  18.  
  19.     for (int row = 0; row < n - 3; row++) {
  20.         cout << repeat(' ', n) << "|" << repeat(' ', n) << endl;
  21.     }
  22.  
  23.     cout << repeat(' ', n - 1) << "_|_" << repeat(' ', n - 1) << endl;
  24.  
  25.     for (int row = 0; row < n - 3; row++) {
  26.         cout << repeat(' ', n - 1) << "|-|" << repeat(' ', n - 1) << endl;
  27.     }
  28.  
  29.     cout << repeat(' ', n - 2) << "_|-|_" << repeat(' ', n - 2) << endl;
  30.  
  31.     for (int row = 0; row < n - 3; row++) {
  32.         cout << repeat(' ', n - 2) << "|***|" << repeat(' ', n - 2) << endl;
  33.     }
  34.  
  35.     cout << " " << repeat('_', n - 3) << "|***|" << repeat('_', n - 3) << " " << endl;
  36.  
  37.     for (int row = 0; row < n * 4 - 1; row++) {
  38.         cout << " " << repeat('|', n - 2) << "---" << repeat('|', n - 2) << " " << endl;
  39.     }
  40.  
  41.     cout << "_" << repeat('|', n - 2) << "---" << repeat('|', n - 2) << "_" << endl;
  42.  
  43.     for (int row = 0; row < n - 2; row++) {
  44.         cout << repeat('|', n * 2 + 1) << endl;
  45.     }
  46.  
  47.     return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement