You are here:

C++/Double dimension ARRAY


Hello Sir,
Please help me solve this program of Double Dimensional array in C++.

WAP to generate a 3 by 3 magic square i.e a square in which the sum of all numbers in each row , in each column & in each diagonal is the same.

Thank you.

Hello, thank you for the question.

Since this appears to be a simple problem from lack of clarity, I'll just go ahead and solve it. Every which a way has to add up to be the same thing. How about this:

int square[3][3] = { {1,1,1}, {1,1,1}, {1,1,1} };

Problem solved as all rows and columns sum up to the same thing.

I hope this information was helpful.

- Eddie


All Answers

Answers by Expert:

Ask Experts




I can answer questions about the C++ language, object oriented design and architecture. I am knowledgable in a lot of the math that goes into programming, and am certified by I also know a good deal about graphics via OpenGL, and GUIs.


I have completed numerous games and demos created with the C++ programming language. Currently employed as a software engineer in the modeling and simulation field. I have about 7 years experience.

©2017 All rights reserved.