Question: Please use C++ for problem number #9... Thank you! 9. A magic square is an nn matrix in which each of the integers 1,2,3,.. n2

Please use C++ for problem number #9... Thank you!  Please use C++ for problem number #9... Thank you! 9. A

9. A magic square is an nn matrix in which each of the integers 1,2,3,.. n2 appears exactly once and all column sums,row sums, and diagonal sums are equal. For example, the following is a 5 x 5 magic square in which all the rows, columns, and diagonals add up to 65: 17 24815 23 57 14 16 4 6 13 20 22 10 | 12 | 19 2113 11 18 25 29 The following is a procedure for constructing an nxn magic square for any odd integer n Place 1 in the middle of the top row. Then, after integer k has been placed, move up one row and one column to the right to place the next integer k 1, unless one of the follow ing occurs: If a move takes you above the top row in the jth column, move to the bottom of the jth column and place k1 there apter 3 Data Structures and Abstract Data Types If a move takes you outside to the right of the square in the ith row, place k +1 in the ith row at the left side. If a move takes you to an already filled square or if you move out of the square at the upper right-hand corner, placek immediately below k. Write a program to construet annXn magic square for any odd value of n 10. Suppose that each of the four edges of a thin square metal plate is maintained at a con- stant temperature and that we wish to determine the steady-state temperature at each interior point of the plate. To do this, we divide the plate into squares (the corners of which are called nodes) and find the temperature at each interior node by averaging the four neighboring temperatures; that is if Ty denotes the old temperature at the node in row i and columnj. then will be the new temperature

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!