include stdafx include math include iostream using namespace std int i

 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
#include "stdafx.h"
//#include "math.h"
#include <iostream>
using namespace std;
int f (int **mas , int n, int m, int &min, int &max )
{
for (int i=0; i<n;i++)
for (int j=0;j<m;j++)
{ if (mas[i][j]>max) max=mas[i][j];
if (mas[i][j]<min) min=mas[i][j];
}
return 0;
}
void main()
{ int n,m;
cin>>n;
cin>>m;
int ** a= new int* [n];
for (int i=0;i<n;i++)
a[i]=new int [m];
for (int i=0; i<n;i++)
for (int j=0;j<m;j++) cin>>a[i][j];
int min=a[0][0], max=a[0][0];
f(a,n,m,min,max);
cout<<min<<endl;
cout<<max<<endl;
for (int i=0; i<n;i++)
delete []a[i];
}