Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Kayoung
/
experiment
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Kayoung
2021-09-28 15:19:40 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d5e68d2e33c1c83a21be3d900b33b2ffbf433e76
d5e68d2e
1 parent
054c3323
Add PrintProgram
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
PrintProgram.cpp
PrintProgram.cpp
0 → 100644
View file @
d5e68d2
#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
);
}
\ No newline at end of file
Please
register
or
login
to post a comment