From b1cb547636f40dc3c33130a860350088f66d8807 Mon Sep 17 00:00:00 2001 From: sweagent Date: Wed, 10 Apr 2024 04:50:36 +0000 Subject: [PATCH] Fix: Better formatting of output Closes #3 --- Magic_square/program.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Magic_square/program.cpp b/Magic_square/program.cpp index 7f8997a..a953381 100644 --- a/Magic_square/program.cpp +++ b/Magic_square/program.cpp @@ -86,17 +86,15 @@ int main() } //We are starting from 1 - cout << "Check The sum of Every row , column and diagonal is " << (n * (n * n + 1)) / 2 << endl; - //TODO:find a better method to format the output in form of a Table which is flexible and more compact. + cout << "Magic Square (Sum of every row, column, and diagonal is " << (n * (n * n + 1)) / 2 << "):" << endl; for (auto v : a) { - //borders - cout<<"-"; - F(i, 0, n) + for (auto val : v) { - cout << "-------"; + cout << setw(5) << val << " "; } cout << endl; + } cout<<"|"; for (auto x : v) { @@ -119,4 +117,4 @@ int main() } cout << endl; return 0; -} \ No newline at end of file +}