Advertisement
Spocoman

Cat Watch

Sep 16th, 2023
642
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.95 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. string repeat(string s, int n) {
  7.     string result;
  8.     for (int i = 0; i < n; i++)
  9.         result += s;
  10.  
  11.     return result;
  12. }
  13.  
  14. int main() {
  15.     int n;
  16.     cin >> n;
  17.  
  18.     for (int i = 1; i <= n - 2; i++) {
  19.         printf("%s||%s||%s\n", repeat(" ", n).c_str(), repeat("_", n - 2).c_str(), repeat(" ", n).c_str());
  20.     }
  21.  
  22.     printf("%s//%s\\\\%s\n", repeat(" ", n - 1).c_str(), repeat(" ", n).c_str(), repeat(" ", n - 1).c_str());
  23.  
  24.     for (int i = 1; i <= n - 4; i++) {
  25.         printf("%s||%s||%s\n", repeat(" ", n - 2).c_str(), repeat("_", n + 2).c_str(), ((i == (n - 3) / 2) ? "]" : ""));
  26.     }
  27.  
  28.     printf("%s\\\\%s//%s\n", repeat(" ", n - 1).c_str(), repeat(" ", n).c_str(), repeat(" ", n - 1).c_str());
  29.  
  30.     for (int i = 1; i <= n - 2; i++) {
  31.         printf("%s||%s||%s\n", repeat(" ", n).c_str(), repeat("_", n - 2).c_str(), repeat(" ", n).c_str());
  32.     }
  33.  
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement