Website Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commitd634f3e6087031564cf76a73fc4cf7b08b5b6678 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2021-10-29 09:30:49 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2021-10-29 10:17:09 +0300
Files71a20ca96c7756019d598fa9e1efc493f1ac3276
Introduction_to_programming_FMI-d634f3e6087031564cf76a73fc4cf7b08b5b6678.tar
Introduction_to_programming_FMI-d634f3e6087031564cf76a73fc4cf7b08b5b6678.tar.gz
Introduction_to_programming_FMI-d634f3e6087031564cf76a73fc4cf7b08b5b6678.zip
Parentb83b99d995793c7a88b7f8ecc8512d5f48b01338 (diff)
Exported line check to a variable and added some readability newlines
1 files changed, 5 insertions, 3 deletions
-rw-r--r--Sem. 03/Solutions/12. Frame.cpp8
diff --git a/Sem. 03/Solutions/12. Frame.cpp b/Sem. 03/Solutions/12. Frame.cpp
index 48ae946..6347ead 100644
--- a/Sem. 03/Solutions/12. Frame.cpp
+++ b/Sem. 03/Solutions/12. Frame.cpp
@@ -9,11 +9,13 @@ int main()
for (int i = 0; i < n; i++)
{
- cout << ((i == 0 || i == n-1) ? "+" : "|");
- for(int j = 0; j < n - 2; j++)
+ bool onFirstOrLastLine = (i == 0 || i == n-1);
+
+ cout << ((onFirstOrLastLine) ? "+" : "|");
for (int j = 0; j < n - 2; j++)
cout << "-";
- cout << ((i == 0 || i == n-1) ? "+" : "|") << endl;
+
+ cout << ((onFirstOrLastLine) ? "+" : "|") << endl;
}
}