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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!