In this post I will gradually add basic mathematical functions that have matrix operations in them. Below is the code for a simple addition of two matrices.

**#include <iostream>**

**using namespace std;**

**int main()**

**{**

** int a[2][2] = {{2,3},**

** {4,5}};**

** int b[2][2] = {{5,2},**

** {9,7}};**

** int matrix[2][2];**

** for(int i = 0; i < 2; i++) {**

** for(int d = 0; d < 2; d++) {**

** matrix[i][d] = a[i][d] + b[i][d];**

** cout << matrix[i][d] << endl;**

** }**

** }**

** system(“PAUSE”);**

** return 0;**

**}**

and here is the logic behind it