Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- int main ()
- {
- int n,m,max=0;
- cout << "Введите размерность матрицы: "; cin >> n;
- m=n;
- int **A=new int *[n];
- for (int i=0; i<n; i++)
- A[i]=new int [m];
- for (int i=0; i<n; i++)
- delete[]A[i];
- delete[]A;
- cout << "Введите элементы матрицы " << n << 'x' << m << ": " << "\n";
- for (int i=0; i<n; i++)
- for (int j=0; j<m; j++) {
- cout << "A[" << i+1 << "][" << j+1 << "]="; cin >> A[i][j]; cout << endl;
- }
- cout << "\nMatrix A" << endl;
- for (int i=0; i<n; i++) {
- for(int j=0; j<m; j++)
- cout << A[i][j] << " ";
- cout << endl;
- }
- cout << endl;
- for (int i=0; i<n; i++) {
- for (int j=0; j<m; j++) {
- cout << A[i][j] << " ";
- cout << endl;
- }
- }
- for (int i=0; i<n; i++)
- for (int j=0; j<m; j++) {
- if (A[i][j] > max) {
- max = A[i][j];
- }
- }
- cout << "Максимальный элемент в заданном промежутке = " << max << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement