@rangerx
1941 / 1550 / 141
Регистрация: 31.05.2009
Сообщений: 2,913
|
24.08.2011, 20:03
|
|
C++ | 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
48
49
50
| #include <iostream>
#include <cstddef>
int main()
{
const std::size_t M = 3;
const std::size_t N = 4;
int arr2D[M][N];
for(std::size_t i = 0; i < M; ++i)
{
for(std::size_t j = 0; j < N; ++j)
{
std::cout << "[" << i+1 << "][" << j+1 << "]:";
std::cin >> arr2D[i][j];
}
}
std::cout << "arr2D:\n";
for(std::size_t i = 0; i < M; ++i)
{
for(std::size_t j = 0; j < N; ++j)
std::cout << arr2D[i][j] << ' ';
std::cout << '\n';
}
int n;
std::cout << "n: ";
std::cin >> n;
int c;
int arr[N];
std::cout << "arr:\n";
for(std::size_t j = 0; j < N; ++j)
{
c = 0;
for(std::size_t i = 0; i < M; ++i)
if(arr2D[i][j] > n) ++c;
arr[j] = c;
std::cout << arr[j] << ' ';
}
std::cout << '\n';
return 0;
} |
|
0
|