Question
***********************The program is C++*********************** A magic square is a 2d square array (# of rows equals # of columns) of positive integers with these properties:
***********************The program is C++***********************
A magic square is a 2d square array (# of rows equals # of columns) of positive integers with these properties:
if n is the array's number of rows and number of columns then
1) the numbers range from 1 to n^2
2) every number in the range appears exactly once
3) the sum of the numbers in a row, in a column, in a diagonal, in an anti-diagonal equals n(n^2 + 1) /2.
4) for any diagonal element, the element's row index equals the element's column index
5) for any anti-diagonal element, the sum of the element's row index and the element's column index equals n - 1.
Write 2 boolean functions that return true if their parameter or parameters define a magic square of false if their parameter or parameters do not define a magic square.
The first function's parameters define a dynamic 2D array, and the second function's parameters define a 2D vector.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started