diff options
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.cpp | 8 |
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; } } |
