#include<iostream>
#include<iomanip>
using namespace std;

const int COLS =4;
const int TBL1_ROWS = 3;
const int TBL2_ROWS = 4;

int totalArray(const int[][COLS], int);

int main()
{
	int table1[TBL1_ROWS][COLS]={{1,2,3,4},
								 {5,6,7,8},
								 {9,10,11,12}};
								 
	int table2[TBL2_ROWS][COLS]={{10,20,30,40},
								 {50,60,70,80},
							     {90,100,110,120},
								 {130,140,150,160}};
	
	cout<<"The sum of all elements for table1 are: "<<totalArray(table1, TBL1_ROWS)<<endl;
	cout<<"The sum of all elements for table2 are: "<<totalArray(table2,TBL2_ROWS);
	return 0;
														
}

int totalArray(const int numbers[][COLS],int rows)
{
	int total=0;
	for(int i=0; i<rows; i++)
		for(int j=0; j<COLS; j++)
			total+=numbers[i][j];
	
	return total;
}
