Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream.h>
- #include <conio.h>
- using namespace std;
- int main() {
- int N, M, k;
- cout<<"Enter the size of arreas(2 numbers): "<<endl;
- cin>>N>>M;
- int mas[N][M], min, max, minI, maxI;
- //------------------------------------------------------------------------------
- for(int i=0; i<N; i++) {
- for(int j=0; j<M; j++) {
- cout<<"Enter arreas: "<<endl;
- cin>>mas[i][j]; } }
- max=mas[0][0];
- min=mas[0][0];
- //------------------------------------------------------------------------------
- for(int i=0; i<N; i++) {
- for(int j=0; j<M; j++) {
- if(mas[i][j]>max) {
- max=mas[i][j];
- maxI=i; }
- if(mas[i][j]<min) {
- min=mas[i][j];
- minI=i; } } }
- //------------------------------------------------------------------------------
- for(int i=0; i<N; i++) {
- for(int j=0; j<M; j++) {
- k=mas[max][i];
- mas[max][i]=mas[min][i];
- mas[min][i]=k; } }
- cout<<"Masiv: "<<endl;
- //------------------------------------------------------------------------------
- for(int i=0; i<N; i++) {
- for(int j=0; j<M; j++) {
- cout<<mas[i][j]<<" "; } }
- cout<<endl<<"min = "<<min<<endl<<"max = "<<max<<endl<<"minI = "<<minI<<endl<<"maxI = "<<maxI<<endl;
- getch(); }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement