Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 05 / task16_sem3.cpp
diff options
context:
space:
mode:
1 files changed, 68 insertions, 0 deletions
-rw-r--r--Sem. 05/task16_sem3.cpp68
diff --git a/Sem. 05/task16_sem3.cpp b/Sem. 05/task16_sem3.cpp
new file mode 100644
index 0000000..bed9616
--- /dev/null
+++ b/Sem. 05/task16_sem3.cpp
@@ -0,0 +1,68 @@
+#include <iostream>
+using namespace std;
+
+
+int main()
+{
+ int n;
+ cin >> n;
+
+
+ //up
+ for (int i = 0; i < n + 2; i++)
+ cout << '#';
+ cout << endl;
+
+
+ for (int i = 0; i < n; i++)
+ {
+ cout << '#';
+
+ for (int j = i + 1; j <= n + i; j++)
+ {
+ if (j > n)
+ cout << j % n;
+ else
+ cout << j;
+
+ }
+ cout << '#' << endl;
+ }
+ //mid
+
+ cout << "#";
+
+ for (int i = 0; i < n; i++)
+ {
+ if (n % 2 == 1 && n / 2 == i)
+ cout << "x";
+ else if (n % 2 == 0 && ((n / 2 == i) || (n / 2 - 1 == i)))
+ cout << "x";
+ else
+ cout << ' ';
+ }
+
+ cout << '#' << endl;
+
+
+ //down
+ for (int i = n - 1; i >= 0; i--)
+ {
+ cout << '#';
+
+ for (int j = i + 1; j <= n + i; j++)
+ {
+ if (j > n)
+ cout << j % n;
+ else
+ cout << j;
+
+ }
+ cout << '#' << endl;
+ }
+
+ for (int i = 0; i < n + 2; i++)
+ cout << '#';
+ cout << endl;
+}
+