int n = 7; int m = 4;
int** arr = new int* [m];
void benef(int** arr, int n, int m) {
srand(time(NULL));
int cou = 0;
int sum = 0;
for (int i = 0; i < n; i++) {
arr[i] = new int[m];
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
arr[i][j] = rand() % 100;
cout << arr[i][j] << "\t";
}
cout << endl;
}
int min = arr[0][0];
int max = arr[0][0];
int maxii = 0;
int maxjj = 0;
int minii = 0;
int minjj = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (max >= arr[i][j]) {
max;
}
else if (max <= arr[i][j]) {
swap(max, arr[i][j]);
maxii = i; maxjj = j;
}
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (min >= arr[i][j]) {
swap(min, arr[i][j]);
minii = i;
minjj = j;
}
else if (min <= arr[i][j]) {
min;
}
}
}
cout << "max=" << max;
cout << "min " << min;
cout << "\nindex max i= " << maxii << " index max j= " << maxjj << endl;
cout << "index min i= " << minii << " index min j= " << minjj << endl;
}
if (max >= arr[i][j]) { max; } else if (max <= arr[i][j]) { swap(max, arr[i][j]); maxii = i; maxjj = j; }