From d634f3e6087031564cf76a73fc4cf7b08b5b6678 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Fri, 29 Oct 2021 09:30:49 +0300 Subject: Exported line check to a variable and added some readability newlines --- Sem. 03/Solutions/12. Frame.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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; } } -- cgit v1.3.1-26-gb76a