?
Solved

c++ code for magic square

Posted on 2009-04-28
4
Medium Priority
?
2,559 Views
Last Modified: 2012-05-06
i need code for  odd magic square number. coditions - no vectors should be used,arrays and multidimensional arrays sould be used, random number generator should be used to  to goverrn  which order of magic square runs and sum of rows ,columns and diagonal should be displayed,
0
Comment
Question by:aeroboy2
  • 2
3 Comments
 
LVL 39

Expert Comment

by:abel
ID: 24253678
That's quite a project! Here's one: http://answers.google.com/answers/threadview/id/380173.html. If you need the explanation, it uses the following as a basis: http://www.codeproject.com/KB/recipes/Magic_Square.aspx which comes with quite an extensive treatise.
0
 

Author Comment

by:aeroboy2
ID: 24254453
thanks a lot , do u know how to add rows and column and display them and random number generator to find the  regulate the size of odd magic square everytime it runs
0
 
LVL 39

Accepted Solution

by:
abel earned 2000 total points
ID: 24254568
Well, I assume that displaying the square can be done anyway you like. Surely, you don't ask me to write the whole project? ;-)

You can use rand() for pseudo random numbers. They are well explained in this post: http://www.daniweb.com/forums/thread1769.html#
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question