#include using namespace std; #define M 100 void NhapMang(int a[][M], int row, int col) { for (int i = 0; i < row; i++) { for (int j = 0; j < col; j++) { cout << "a[" << i << "][" << j << "]:"; cin >> a[i][j]; } cout << endl; } } void XuatMang(int a[][M], int row, int col) { for (int i = 0; i < row; i++) { for (int j = 0; j < col; j++) { cout << a[i][j] << "\t"; } cout << endl; } } void CongMaTran(int a[][M],int b[][M], int row, int col,int row2,int col2) { int k; for (int i = 0; i < row; i++) { for (int j = 0; j < col; j++) { k = a[i][j] + b[i][j]; cout << k << "\t"; } cout << endl; } } int main() { int a[M][M], row, col, b[M][M], row2, col2; cout << "Mang A" << endl; cout << "Input row:"; cin >> row; cout << "Input collum:"; cin >> col; NhapMang(a, row, col); XuatMang(a, row, col); cout << "Mang B" << endl; cout << "Input row2:"; cin >> row2; cout << "Input collum2:"; cin >> col2; if (row == row2 && col == col2) { NhapMang(b, row2, col2); XuatMang(b, row2, col2); cout << "Tong la" << endl; CongMaTran(a, b, row, col, row2, col2); } else cout << "Hai ma tran khong cung kich thuoc"; return 1; }