Question: Code in C++ A Lo Shu Magic Square is a 3 X 3 grid of integers, with the following characteristics: -the grid contains the numbers
Code in C++ A Lo Shu Magic Square is a 3 X 3 grid of integers, with the following characteristics: -the grid contains the numbers 1 through 9, exactly. -when the numbers in each row, each column, and each diagonal are individually summed, the sum for each is the same (the sum is magic).
In main define a 3 X 3 two-dimensional array of integers to represent a grid.
Repeatedly: call a function which has the user fill the array with integers (1-9), then call a second function which determines if the array is a Magic Square and returns true if so or false if not. In main display the result, and if true also display the magic sum, returned from the second function via a reference variable.
Submit two screen prints with the following input:
First Grid
Row 1: 1, 2, 3 Row 2: 4, 5, 6 Row 3: 7, 8, 9
Second Grid
Row 1: 4, 9, 2 Row 2: 3, 5, 7 Row 3: 8, 1, 6
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
