Summary Files Commits Branches @commit @diff @stats
path: root / Year 1 / Programming introduction / Solutions Sem. 03 / 12. Frame.cpp
diff options
context:
space:
mode:
1 files changed, 21 insertions, 0 deletions
-rw-r--r--Year 1/Programming introduction/Solutions Sem. 03/12. Frame.cpp21
diff --git a/Year 1/Programming introduction/Solutions Sem. 03/12. Frame.cpp b/Year 1/Programming introduction/Solutions Sem. 03/12. Frame.cpp
new file mode 100644
index 0000000..6eca5a2
--- /dev/null
+++ b/Year 1/Programming introduction/Solutions Sem. 03/12. Frame.cpp
@@ -0,0 +1,21 @@
+#include <iostream>
+
+using namespace std;
+
+int main()
+{
+ int n;
+ cin >> n;
+
+ for (int row = 0; row < n; row++)
+ {
+ bool onFirstOrLastLine = (row == 0 || row == n-1);
+
+ cout << ((onFirstOrLastLine) ? "+ " : "| ");
+
+ for (int col = 0; col < n - 2; col++)
+ cout << "- ";
+
+ cout << ((onFirstOrLastLine) ? "+" : "|") << endl;
+ }
+}