can any one help me with magic sqaure

probably. Do you have some code?

i got it thanks for relpy
ing

Have ever got your code working??
I just got to that assignment and has some toruble adding the 2 diagonals = 30
I put all my function in Myfunction.h, I have main.cpp and functionCall.cpp. It did't add Diaginals correctely.

this in the header

// Function proto type
int Rows (int Ro[3][3]);
int Columns (int Co[3][3]);
int num(int C[3][3]);

this main.cpp

#include <iostream>
#include "Myfunction.h"


int main()

{
        using namespace std;

        //Declare 2-D arrays
        const int A = 3;
        const int B = 3;
        int C[A][B] = // initialize the first 2-D array
        {
            {1,2,3}, //values for C[0]
            {4,5,6}, //values for C[1]
            {7,8,9} //values for C[2]
        };

        cout << "They sum to: " << num(C)<< endl; // Display the output

        cin.get();
        return 0;

}

this is FunctionCall.cpp

#include <iostream>
#include "Myfunction.h"
using namespace std;


int num(int D[3][3])
{

    int A = 3;
    int B = 3;
        int i,j;
        int sum = 0;
             for(i = 0; i < A; i++)
                for(j = 0; j < B; j++)
                    sum += D[i][j];// Perform addition
        return sum;
}

i got it thanks for relpying

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.