Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void inputArray(int** arr, int N)
- {
- cout << "Введите элементы массива A " << endl;
- for (int i = 0; i < N; i++)
- {
- for (int j = 0; j < N; j++)
- {
- cout << "A[" << i+1 << "][" << j+1 << "]=";
- cin >> arr[i][j];
- }
- }
- }
- void OutputArray(int** arr, int N)
- {
- cout << "Полученная матрица размера " << N << "x" << N << endl;
- for (int i = 0; i < N; i++)
- {
- for (int j = 0; j < N; j++)
- {
- cout << arr[i][j] << " ";
- }
- cout << endl;
- }
- cout << endl;
- }
- void SortArray(int** arr, int N)
- {
- int max = 0;
- int i = 0, j = 0;
- int find = 0;
- max = arr[0][0];
- for (int i = 0; i < N; i++)
- for (int j = 0; j < N; j++)
- if (max < arr[i][j])
- {
- max = arr[i][j];
- find = i + 1;
- }
- cout << "Максимальный элемент равен " << max << " В строке № " << find << endl;
- }
- int main()
- {
- setlocale(LC_ALL, "rus");
- cout << "Введите размерность квадратной матрицы N\n";
- int N = 0;
- cin >> N;
- int** dinamic_array = new int* [N];
- for (int i = 0; i < N; i++)
- {
- dinamic_array[i] = new int[N];
- }
- inputArray(dinamic_array, N);
- OutputArray(dinamic_array, N);
- SortArray(dinamic_array, N);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement