See Plus Plus,
Okie, for the 1 st one ,code is below. for the 2nd one, just change the a[i][k]>a[j][k] to a[i][k]<a[j][k] ....
EDIT: convert it to c++, ive written in C.
int main(void)
{
int b[5][4],i,j,temp[5][4],k;
int a[5][4]={3,33,333,3333,5,55,555,5555,1,11,111,1111,4,44,4 44,4444,2,22,222,2222};
for(k=0;k<4;k++)
{
for(i=0;i<5;i++)
{
for(j=0;j<4;j++)
{
if(a[i][k]>a[j][k])
{
temp[i][k]=a[i][k];
a[i][k]=a[j][k];
a[j][k]=temp[i][k];
}
}
}
}
printf("\n");
for(i=0;i<5;i++)
{
for(j=0;j<4;j++)
{
printf("%d",a[i][j]);
printf(" ");
}
printf("\n");
}
}