#include using namespace std; //prototypes void readMatrix(double ar[][2], int rows, int cols); void matrixAdd(double a[][2], double b[][2], double result[][2], int rows, int cols); void printMatrix(double ar[][2], int rows, int cols); int main(void) { double a[2][2]; //our first matrix double b[2][2]; //our second matrix double c[2][2]; //the result matrix //get the matrices cout << "Enter matrix A" << endl; readMatrix(a, 2, 2); cout << "Enter matrix B" << endl; readMatrix(b, 2, 2); //add the matrices matrixAdd(a, b, c, 2, 2); //show the result cout << "A+B=" << endl; printMatrix(c, 2, 2); return 0; } void readMatrix(double ar[][2], int rows, int cols) { //loop over the 2d array for(int i=0; i> ar[i][j]; } } } void matrixAdd(double a[][2], double b[][2], double result[][2], int rows, int cols) { //loop over the 2d array for(int i=0; i