Summary Files Commits Branches @commit @diff @stats
path: root / Year 1 / Programming introduction / Solutions Sem. 03 / 13. Dumbbell.cpp
diff options
context:
space:
mode:
Commit3f402620ecd071fb467b108036ac08ed48c5f929 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2021-11-03 21:18:33 +0200
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2021-11-03 21:18:33 +0200
Files4c18cc86afc1c951f02768bfd9dc1b4e2ab8df99 /Year 1/Programming introduction/Solutions Sem. 03/13. Dumbbell.cpp
uni-projects-3f402620ecd071fb467b108036ac08ed48c5f929.tar
uni-projects-3f402620ecd071fb467b108036ac08ed48c5f929.tar.gz
uni-projects-3f402620ecd071fb467b108036ac08ed48c5f929.zip
Parentdf27afaa9a5bb3d3a168b57c8c407d25e553f13f (diff)
Updated some styling and formatting
1 files changed, 6 insertions, 2 deletions
-rw-r--r--Year 1/Programming introduction/Solutions Sem. 03/13. Dumbbell.cpp8
diff --git a/Year 1/Programming introduction/Solutions Sem. 03/13. Dumbbell.cpp b/Year 1/Programming introduction/Solutions Sem. 03/13. Dumbbell.cpp
index 7db650a..e0afd63 100644
--- a/Year 1/Programming introduction/Solutions Sem. 03/13. Dumbbell.cpp
+++ b/Year 1/Programming introduction/Solutions Sem. 03/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;
}