Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Laba_5.5.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- int main()
- {
- int **mas;
- int i,j,m,n;
- cout<<"N M:";
- cin>>n>>m;
- mas = new int*[n];
- for(i=0;i<n;i++)
- mas[i]=new int[m];
- int max,k; /*вводите числа не меньше максимального <=*/
- for(j=0;j<m;j++)
- {
- cin>>mas[0][j];
- max=0;
- for(i=1;i<n;i++)
- {
- cin>>mas[i][j];
- if(abs(mas[i][j])>abs(mas[max][j]))
- {
- max=mas[i][j];
- mas[i][j]=mas[j][j];
- mas[j][j]=max;
- }
- }
- }
- cout<<endl;
- for(j=0;j<m;j++)
- for(i=0;i<n;i++)
- {
- cout<<mas[i][j]<<" ";
- if(i==n-1)
- {
- cout<<endl;
- }
- }
- for(i=0; i<n; i++)
- delete [ ]mas[i];
- delete [ ]mas;
- mas=NULL;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment