#include using namespace std; class matrix3 { int a[10][10],b[10][10],c[10][10],d[10][10],e[10][10],f[10][10],x,y,i,j; public : void values(); void mul(); void add(); void sub(); }; void matrix3::values() { cout << "Enter the rows "; cin >> x; cout << "Enter the columns "; cin >> y; cout << "Enter elements of first matrix\n\n"; for (i=1; i<=x; i++) { for ( j=1; j<=y; j++) { cin >> a[i][j]; } } cout << "Enter elements of second matrix\n\n"; for (i=1; i<=x; i++) { for (j=1; j<=y; j++) { cin >> c[i][j]; } } } void matrix3::add() { cout << "Addition of Matrices 1 and 2 is\n"; for (i=1; i<=x; i++) { for ( j=1; j<=y; j++) { e[i][j]=a[i][j]+c[i][j]; cout << e[i][j] << ""; } cout << endl; } } void matrix3::sub() { cout << "Subtraction of Matrices 1 and 2 is\n"; for (i=1; i<=x; i++) { for ( j=1; j<=y; j++) { f[i][j] = a[i][j]-c[i][j]; cout << f[i][j] << ""; } cout << endl; } } void matrix3::mul() { cout << "Multiplication of Matrices 1 and 2 is\n"; for (i=1; i<=x; i++) { for ( j=1; j<=y; j++) { f[i][j] = a[i][j]*c[i][j]; cout << f[i][j] << ""; } cout << endl; } } int main() { int input; char ch; matrix3 m; m.values(); do { cout << "Enter your choice\n"; cout << " 1. Addition of 1 and 2\n" << " 2. Subtraction of 1 and 2\n" << " 3. Multiplication of both 1 amd 2\n"; cin >> input; switch (input) { case 1: m.add(); break; case 2: m.sub(); break; case 3: m.mul(); break; } cout << "\nDo another y/n?"; cin >> ch; } while (ch!= 'n'); cout << "\n"; system ("pause"); return 0; }