Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <iostream>
- #include <cmath>
- #define N 105
- using namespace std;
- ifstream fin(".in");
- ofstream fout(".out");
- ///620
- int a[N][N],n,m;
- int main()
- {
- cin>>n>>m;
- for(int i=1; i<=n; ++i)
- for(int j=1; j<=m; ++j)
- cin>>a[i][j];
- ///parcurg coloanele
- for(int j=1; j<=m; j++)
- {
- bool ord=0;
- while(!ord)
- {
- ord=1;
- for(int i=1; i<n; ++i)
- if(a[i][j]<a[i+1][j])
- swap(a[i][j],a[i+1][j]),ord=0;
- }
- }
- ///afisare matrice
- for(int i=1;i<=n; ++i, cout<<"\n")
- for(int j=1;j<=m;++j)
- cout<<a[i][j]<<" ";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement