@bradobrei
Продам уран 238U
119 / 119 / 23
Регистрация: 22.01.2013
Сообщений: 298
|
25.12.2013, 09:11
|
|
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
| #include <iostream>
#include <cstdlib>
using namespace std;
#define n 5
int main(){
int in[n][n];
int maxi[n];
int max;
cout<<"IN:"<<endl;
for(int i = 0; i < n; i++){
for(int j = 0; j < n ; j++){
in[i][j] = rand()% 100 + 0;
cout<<in[i][j]<<" ";
}
cout<<endl;
}
for(int i = 0; i < n; i++){
max = -9999;
for(int j = 0; j < n ; j++){
if(max < in[j][i])
max = in[j][i];
}
maxi[i] = max;
}
int out[n + 1][n];
cout<<endl<<"OUT:"<<endl;
for(int i = 0; i < n + 1; i++){
for(int j = 0; j < n ; j++){
if(i == n)
out[i][j] = maxi[j];
else
out[i][j] = in[i][j];
cout<<out[i][j]<<" ";
}
cout<<endl;
}
return 0;
} |
|
0
|