can someone tell me how to create magic square on c++ that something like this:
816
357
492
i need to create a program to prove the numbers that i will insert is magic square or not.. :'(
i really need it.. my brain blank when i want to do it :'(
HELP ME PLEASE..

For your problem I would suggest using a 2-dimensional array.

This way you can easily compute the sum of the rows, columns, or diagonals. Have a look at the link and notice how they use nested for loops to iterate through the 2 dimensional array.

Then compare the results of the sums you collected for the rows, columns, and diagonals with each other to check if it is indeed a magic square

thank you soo much..
i get the clear view now..
^^

thank you very much.. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.