Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions Magic_square/program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -119,4 +117,4 @@ int main()
}
cout << endl;
return 0;
}
}