Kayoung

Modify PrintProgram

......@@ -2,10 +2,10 @@
#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];
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;
}
......@@ -13,12 +13,12 @@ void printMatrix(int(*inMatrix)[4]) {
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++) {
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];
......