valeriikozlov
4680 / 2506 / 322
Регистрация: 18.08.2009
Сообщений: 4,550
|
06.05.2012, 09:35
|
|
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
| #include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
#define N 5
int main()
{
srand( time( NULL ) );
int a[N][N], i, j, col=0, max;
cout<<"Ishodn matr:\n";
for(i=0; i<N; i++)
{
for(j=0; j<N; j++)
{
a[i][j]=rand()%10;
cout<<a[i][j]<<" ";
}
cout<<endl;
}
max=a[0][0];
for(i=0; i<N; i++)
for(j=0; j<N; j++)
{
if(a[i][j]==max)
col++;
if(a[i][j]>max)
{
max=a[i][j];
col=1;
}
}
cout<<"Maximum: "<<max<<endl<<"Vstrech "<<col<<" ras"<<endl;
return 0;
} |
|
1
|