c++ code for magic square

Posted on 2009-04-28
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,
Question by:aeroboy2
    LVL 39

    Expert Comment

    That's quite a project! Here's one: If you need the explanation, it uses the following as a basis: which comes with quite an extensive treatise.

    Author Comment

    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
    LVL 39

    Accepted Solution

    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:

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    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++ ( I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now