Răspuns :
Răspuns:
#include <iostream>
using namespace std;
void citire (int a[][100], int n, int m) {
int i, j;
for (i = 0;i < n; i++)
for (j = 0;j < m; j++){
cout << "a[" << i << "][" << j << "]=";
cin >> a[i][j];
}
}
void afisare (int a[][100], int n, int m) {
int i, j;
for (i = 0;i < n; i++){
for (j = 0;j < m; j++)
cout << a[i][j] << ' ';
cout << endl;
}
}
void max_row (int a[][100], int n, int m, int b[], int &k){
int i, j;
for (i = 0;i < n; i++) {
int max = a[i][0];
for (j = 1;j < m; j++)
if (a[i][j] > max)
max = a[i][j];
b[k] = max;
k++;
}
}
int min_of_max (int b[], int k ){
int min = b[0];
for (int i = 1;i < k; i++)
if (b[i] < min)
min = b[i];
return min;
}
int main(){
int a[100][100];
int i, j;
int m, n;
int k = 0;
int b[100];
cout << "n=";
cin >> n;
cout << "m=";
cin >> m;
citire(a,n,m);
afisare(a,n,m);
max_row(a,n,m,b,k);
cout << min_of_max(b,k);
cout << endl;
return 0;
}
Explicație: