You are on page 1of 1

#include<conio.

h>
#include<fstream.h>
#include<stdlib.h>
#include<time.h>
void main()
{ srand(time(NULL));
int a[100][100],b[100],N,M,P,i,j,k,x,y,m,n,men,l,may;
cout<<"INGRESE LAS FILAS Y COLUMNAS DE LA MATRIZ\n";
cin>>N;
cin>>M;
cout<<"CARGA DE DATOS DE LA MATRIZ\n";
for(i=0;i<N;i++)
{cout<<"\n";
for(j=0;j<M;j++)
{ a[i][j]=1+rand()%30;
cout<<a[i][j]<<"\t";
}
}

cout<<"\nQUE FILA DESEA ORDENAR DE FORMA ASCENDENTE\n";


cin>>l;

//ordenando en forma ascendente


{i=l-1;
//for( i=0; i<N-1; i++)

for( j=0; j<M-1; j++)


{for(x=0;x<M-1;x++)
{if(a[i][x]>a[i][x+1])
{may=a[i][x];
a[i][x]=a[i][x+1];
a[i][x+1]=may;
}
}
}

}
cout<<"\n";

for(int i=0; i<N; i++)


{for(int j=0; j<M; j++)
cout<<a[i][j]<<"\t";
cout<<endl;
}

getch();
}

You might also like