Advertisement
Spocoman

Eiffel Tower

Sep 25th, 2023 (edited)
513
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.12 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; row++) {
  20.         cout << repeat('-', n + 2) << "**" << repeat('-', n + 2) << endl;
  21.     }
  22.     for (int row = 0; row < n - 3; row++) {
  23.         cout << repeat('-', n + 1) << "****" << repeat('-', n + 1) << endl;
  24.     }
  25.     cout << repeat('-', n) << "******" << repeat('-', n) << endl;
  26.  
  27.     for (int row = 0; row < n - 4; row++) {
  28.         cout << repeat('-', n) << "**--**" << repeat('-', n) << endl;
  29.     }
  30.     for (int row = 0; row < n - 3; row++) {
  31.         cout << repeat('-', n - 1) << "**----**" << repeat('-', n - 1) << endl;
  32.  
  33.     }
  34.     cout << repeat('-', n - 2) << "**********" << repeat('-', n - 2) << endl;
  35.  
  36.     for (int row = n - 3; row > 0; row--) {
  37.         cout << repeat('-', row) << "**" << repeat('-', 2 * n + 2 - 2 * row) << "**" << repeat('-', row) << endl;
  38.     }
  39.     cout << "***" << repeat('-', 2 * n) << "***" << endl;
  40.  
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement