From 3f402620ecd071fb467b108036ac08ed48c5f929 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Wed, 3 Nov 2021 21:18:33 +0200 Subject: Updated some styling and formatting --- .../Solutions Sem. 03/15. Bowtie.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'Year 1/Programming introduction/Solutions Sem. 03/15. Bowtie.cpp') diff --git a/Year 1/Programming introduction/Solutions Sem. 03/15. Bowtie.cpp b/Year 1/Programming introduction/Solutions Sem. 03/15. Bowtie.cpp index e06ab7e..61c5df3 100644 --- a/Year 1/Programming introduction/Solutions Sem. 03/15. Bowtie.cpp +++ b/Year 1/Programming introduction/Solutions Sem. 03/15. Bowtie.cpp @@ -7,26 +7,29 @@ int main() { cin >> n; char middleSpacer = ' '; - for(int i = -n + 1; i < n; i++) + for (int i = -n + 1; i < n; i++) { int absI = (i < 0) ? -i : i, diff = n - absI; - /* Numbers on the left */ - for(int j = 1; j <= diff; j++) + // Numbers on the left + + for (int j = 1; j <= diff; j++) cout << j << " "; - /* Spaces/Line in the middle */ + // Spaces/Line in the middle + if (i == 0) middleSpacer = '-'; - for(int j = 5 * n - 4 * diff; j > 0; j--) + for (int j = 5 * n - 4 * diff; j > 0; j--) cout << middleSpacer; if (i == 0) middleSpacer = ' '; - /* Number on the right */ - for(int j = diff; j > 0; j--) + // Number on the right + + for (int j = diff; j > 0; j--) cout << " " << j; cout << endl; -- cgit v1.3.1-26-gb76a