Website Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commit91c58192153aec6803de90951e2d72b36fcc4e16 (patch)
Author
 Angel Dimitriev <achi_d@abv.bg>
2021-11-03 18:27:18 +0200
Committer
 GitHub <noreply@github.com>
2021-11-03 18:27:18 +0200
Filesa27e3854dc30ee7e99f1547940bf06a38ab038c7
Introduction_to_programming_FMI-91c58192153aec6803de90951e2d72b36fcc4e16.tar
Introduction_to_programming_FMI-91c58192153aec6803de90951e2d72b36fcc4e16.tar.gz
Introduction_to_programming_FMI-91c58192153aec6803de90951e2d72b36fcc4e16.zip
Parentd0903680e8c5d1fbbde7b41c3dd2ad58201c2c30 (diff)
Create draw
1 files changed, 58 insertions, 0 deletions
-rw-r--r--Sem. 05_kn/draw58
diff --git a/Sem. 05_kn/draw b/Sem. 05_kn/draw
new file mode 100644
index 0000000..652a201
--- /dev/null
+++ b/Sem. 05_kn/draw
@@ -0,0 +1,58 @@
+#include <iostream>
+using namespace std;
+
+int main()
+{
+ int n;
+ cin >> n;
+
+ int spacesCount = 2 * (n - 1) + n + 2 * (n - 1);
+ int toGuess;
+ for (int i = 1; i <= n - 1; i++)
+ {
+ for (int j = 1; j <= i; j++)
+ cout << j << " ";
+
+ for (int j = 0; j < spacesCount; j++)
+ cout << " ";
+
+ for (int j = i; j >= 1; j--)
+ cout << " " << j;
+
+ spacesCount -= 4;
+
+ cout << endl;
+
+ }
+
+ //mid
+ for (int i = 1; i <= n; i++)
+ cout << i << " ";
+ for (int i = 0; i < n; i++)
+ cout << '-';
+ for (int i = n; i >= 1; i--)
+ cout << " " << i;
+ cout << endl;
+
+
+ //down
+ spacesCount += 4;
+ for (int i = n - 1; i >= 0; i--)
+ {
+ for (int j = 1; j <= i; j++)
+ cout << j << " ";
+
+ for (int j = 0; j < spacesCount; j++)
+ cout << " ";
+
+ for (int j = i; j >= 1; j--)
+ cout << " " << j;
+
+ spacesCount += 4;
+
+ cout << endl;
+
+ }
+
+
+}