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 +}