From f51185d90bfe76d1fef272fe449c1d3d3bb89528 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Wed, 3 Nov 2021 21:15:51 +0200 Subject: Made some minor formatting and style changes to improve readability --- Sem. 03/Solutions/13. Dumbbell.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Sem. 03/Solutions/13. Dumbbell.cpp') diff --git a/Sem. 03/Solutions/13. Dumbbell.cpp b/Sem. 03/Solutions/13. Dumbbell.cpp index 7db650a..e0afd63 100644 --- a/Sem. 03/Solutions/13. Dumbbell.cpp +++ b/Sem. 03/Solutions/13. Dumbbell.cpp @@ -14,12 +14,16 @@ int main() if (row == 0 || row == n - 1) { for (int col = 0; col < rowWidth; col++) - cout << ((col >= n && col <= rowWidth - n - 1) ? " " : "."); + cout << ((col >= n && col <= rowWidth - n - 1) ? " " : "."); // Print spaces in the middle } else { for (int col = 0; col < rowWidth; col++) - cout << (((col >= 1 && col <= n - 2) || (col >= rowWidth - n + 1 && col <= rowWidth - 2)) ? " " : "."); + { + bool inLeftHole = (col >= 1 && col <= n - 2); + bool inRightHole = (col >= rowWidth - n + 1 && col <= rowWidth - 2); + cout << ((inLeftHole || inRightHole) ? " " : "."); + } } cout << endl; } -- cgit v1.3.1-23-gd82d