I want from you to give me a cpp code of a magic squire like this .. one dimention array takes 16 integers then put these 16 integers in 2 dimention array then test this array if it's a magic squire or not .. if not we will randomily rewrite the values of the integers in the one dimention array
please help me !!

I want somebody to do all my work for me too. But that's not how it works here on DaniWeb. Here, you write the code, and if there's something you don't understand, or if you're stuck on a particular point, you post the code you've written so far, along with a clear statement of what you don't understand, what you do understand, and what resulting question(s) you have.

Here's a sample to get you started, but feel free to edit it so it meets your needs:
I have an assignment to implement a magic square in C++. I have defined a MagicSquare class with a member variable of a 4x4 array of integers, a couple of different constructors, and a method to determine whether the values in the array form a magic square. Where I'm stuck is filling the array with random values. Here's my code so far:

class MagicSquare {
    // 4x4 array of values
    MagicSquare(int v00, int v01, int v02, int v03,
                int v10, int v11, int v12, int v13,
                int v20, int v21, int v22, int v23,
                int v30, int v31, int v32, int v33);
    MagicSquare();  // default constructor

    bool isMagicSquare();  // method to determine whether the values form a magic-square


I'm assuming you won't make me (or anyone else here) do this much work for you again next time....

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.