Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Laba_5.5_XIII.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- int main()
- {
- int n,m,i,j;
- cout<<"Vvedite n i m:\n";
- cin>>n>>m;
- double **mas;
- mas = new double*[n];
- for (int i=0 ; i<n ; i++ )
- mas[i] = new double[n];
- double nmax,nmin;
- bool flagmin=true, flagmax=true;
- for(i=0;i<m;i++)
- for(j=0;j<n;j++)
- {
- cin>>mas[i][j];
- //min vishe glavnoj
- if((flagmin) && (j>i))
- {
- nmin=mas[i][j];
- flagmin=false;
- }
- else
- if ((j>i) && (mas[i][j]<nmin))
- nmin=mas[i][j];
- //max nizhe pobochnoj
- if((flagmax) && (j>n-i-1))
- {
- nmax=mas[i][j];
- flagmax=false;
- }
- else
- if ((j>n-i-1) && (nmax<mas[i][j]))
- nmax=mas[i][j];
- }
- for(i=0; i<n; i++)
- delete [ ]mas[i];
- delete [ ]mas;
- mas=NULL;
- cout<<"\nmax sredi elem nizhe pobochnoj="<<nmax<<endl;
- cout<<"\nmin sredi elem vishe glavnoj="<<nmin<<endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment