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

Edited 3 Years Ago by mike_2000_17: Fixed formatting

This article has been dead for over six months. Start a new discussion instead.