#include <iostream> using namespace std; int main() { int mxr; int mxc; std::cout << "Enter desired max of the array: " << endl; cin >> mxr; cin >> mxc; int** arr = new int* [mxc]; // создание размерности матрицы из данных с клавиатуры for (int i = 0; i < mxc; ++i) { arr[i] = new int[mxr]; } cout << "Введите элементы матрицы: " << endl; int mx_x = 0, mx_y = 0; int mn = 0; for (int i = 0; i < mxr; i++) //ввод матрицы { for (int j = 0; j < mxc; j++) { cin >> arr[i][j]; if (arr[i][j] < arr[i][mn]) mn = j; } if (arr[i][mn] > arr[mx_y][mx_x]) { mx_x = mn; mx_y = i; } } for (int i = 0; i < mxr; i++) //вывод матрицы { for (int j = 0; j < mxc; j++) { std::cout << arr[i][j] << "\t"; } cout << endl; } cout << arr[mx_y][mx_x] << endl; cout << endl; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter