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

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

int main() {
	srand((unsigned int)time(NULL));
	int matrix1[4][4];
	int matrix2[4][4];
	int sum[4][4];
	int mul[4][4];
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 4; 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);
}