-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmatrix.cpp
More file actions
47 lines (40 loc) · 1.07 KB
/
matrix.cpp
File metadata and controls
47 lines (40 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <iostream>
int main()
{
setlocale(LC_ALL, "rus");
const int rows = 3, columns = 6;
int arr_int[rows][columns] =
{
{19,20,21,22,23,24},
{25,26,27,28,29,30},
{31,32,33,34,35,36}
};
int min = arr_int[0][0];
int max = arr_int[0][0];
std::cout << "Ìàññèâ:" << std::endl;
for (int row{}; row < rows; ++row)
{
for (int column{}; column < columns; ++column)
{
std::cout << arr_int[row][column] << '\t';
}
std::cout << std::endl;
}
for (int row = 0; row < rows; ++row)
{
for (int col = 0; col < columns; ++col)
{
if (arr_int[row][col] > max)
{
max = arr_int[row][col];
}
if (arr_int[row][col] < min)
{
min = arr_int[row][col];
}
}
}
std::cout << "Ìèíèìàëüíûé ýëåìåíò:" << " " << min << std::endl;
std::cout << "Ìàêñèìàëüíûé ýëåìåíò:" << " " << max << std::endl;
return 0;
}