Just need help displaying the sum

// Hey guys, i need help displaying the sum of the major diagonal sum. I created the function that will sum the number of the main diagonal of a matrix. But, i am having problems displaying it
#include <iostream>

using namespace std;
const int SIZE = 4;
int sumdiag(const double matrix[][SIZE])
{
int i = 0, j = 0;
int sum = 0;
for (i = 0;i<4;i++)
{
for (j = 0;j<4;j++)
{
if (i == j) //()
sum += matrix[i][j];
}
}
return sum;
}


//int sumdiag(int matriz[][4]);
int main() {
int matrix[4][4];
int columnIndex, i = 0, j = 0, sumadiag = 0;

cout << "Please Enter a 4-by-4 matrix row by row: " << endl;;
for (i = 0;i<4;i++)
{
for (j = 0;j<4;j++)
{

cin >> matrix[i][j];
}
}

for (i = 0;i<4;i++)
{
for (j = 0;j<4;j++)
{
printf(" ", matrix[i][j]);
}
printf("\n");

}
cout << "The main diagonal sum of the matrix is: " << (sumadiag,matrix) << endl;// Here is my cout that should be displaying the sum

return 0;
}
Topic archived. No new replies allowed.