PrintProgram.cpp 674 Bytes
#include <iostream>
#include <iomanip>
using namespace std;

void printMatrix(int(*inMatrix)[5]) {
	for (int i = 0; i < 5; i++) {
		for (int j = 0; j < 5; j++) {
			cout << left << setfill(' ') << setw(8) << inMatrix[i][j];
		}
		cout << endl;
	}
}

int main() {
	srand((unsigned int)time(NULL));
	int matrix1[5][5];
	int matrix2[5][5];
	int sum[5][5];
	int mul[5][5];
	for (int i = 0; i < 5; i++) {
		for (int j = 0; j < 5; j++) {
			matrix1[i][j] = rand() % 101;
			matrix2[i][j] = rand() % 101;
			sum[i][j] = matrix1[i][j] + matrix2[i][j];
			mul[i][j] = matrix1[i][j] * matrix2[i][j];
		}
	}
	cout << "Sum:\n";
	printMatrix(sum);
	cout << "Mul:\n";
	printMatrix(mul);
}