#include<fstream>
using namespace std;
ifstream fin("f.in");
ofstream fout("f.out");
int main()
{
int a[10][10],n,m,i,j,k,aux;
fin>>n>>m;
for(i=1;i<=n;i++)
for(j=1;j<=m;j++)
fin>>a[i][j];
for(k=1;k<=n;k++)
for(i=1;i<m;i++)
for(j=i+1;j<=m;j++)
if(a[k][i]>a[k][j])
{
aux=a[k][i];
a[k][i]=a[k][j];
a[k][j]=aux;
}
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
fout<<a[i][j]<<" ";
fout<<endl;
}
fin.close();
fout.close();
return 0;
}
|