Quipex

Laba_5.5(доделать)

Oct 12th, 2015
366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. // Laba_5.5.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. using namespace std;
  7.  
  8.  
  9. int main()
  10. {  
  11.     int **mas;
  12.  
  13.     int i,j,m,n;
  14.     cout<<"N M:";
  15.     cin>>n>>m;
  16.     mas = new int*[n];
  17.     for(i=0;i<n;i++)
  18.         mas[i]=new int[m];
  19.     int max,k;          /*вводите числа не меньше максимального <=*/
  20.     for(j=0;j<m;j++)
  21.     {
  22.         cin>>mas[0][j];
  23.         max=0;
  24.         for(i=1;i<n;i++)
  25.         {
  26.             cin>>mas[i][j];
  27.             if(abs(mas[i][j])>abs(mas[max][j]))
  28.             {
  29.                 max=mas[i][j];
  30.                 mas[i][j]=mas[j][j];
  31.                 mas[j][j]=max;
  32.             }
  33.         }
  34.     }
  35.     cout<<endl;
  36.     for(j=0;j<m;j++)
  37.         for(i=0;i<n;i++)
  38.         {
  39.            
  40.             cout<<mas[i][j]<<" ";
  41.             if(i==n-1)
  42.             {
  43.                 cout<<endl;
  44.             }
  45.         }
  46.     for(i=0; i<n; i++)
  47.         delete [ ]mas[i];
  48.     delete [ ]mas;
  49.     mas=NULL;
  50.     system("pause");
  51.     return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment