Description
Hello, I need help with writing a C++ code. All the instructions are attached below. Be sure to meet all the requirements!
Unformatted Attachment Preview
Magic Square
Focus on: Array access
A Magic Square is a square array of integers such that the sum of every row, the sum of
every column, and sum of each diagonal are equal.
Task: Define a class, namely MagicSquare, that generates a magic square by the
following method. This method works only when the size of the square is an odd
number. Starting by placing 1 in the middle of the top row, write down successive
integers2, 3, … along a diagonal going upwards and to the right. When you reach the top
tow ( as you do immediately since 1 is in the top row.), continuing to the bottom row as
though the bottom row were immediately above the top row. When you reach the
rightmost column, continue to the leftmost column as though it were immediately to the
right of the rightmost one. When you reach a position that is already occupied, instead
drop straight down one position from the previous number to insert the new one. The 5 *
5 magic square is shown:
17
23
4
10
11
24
5
6
12
18
1
7
13
19
25
8
14
20
21
2
15
16
22
3
9
Your program reads a N * N square from the keyboard ( 3
Purchase answer to see full
attachment