回复 4楼 linlulu001
额。。。好吧,那麻烦了= =
#include <stdio.h>
#include <stdlib.h>
#define N 3
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
void ah(int score[5][3],int length);
void out(int score[5][3],int length);
int main(int argc, char *argv[]) {
int s[5][3]={{3,4,2},{6,4,7},{6,0,9},{4,3,4},{5,4,2}};
printf("程序排序如下:\n");
ah(s,5);
out(s,5);
return 0;
}
void ah(int score[5][3],int length)
{
int i,j,k,t;
for(i=0;i<length;i++)
{
for(j=0;j<N-1;j++)
{
for(k=0;k<N-j-1;k++)
{
if(score[i][k]>score[i][k+1])
{
t=score[i][k];
score[i][k]=score[i][k+1];
score[i][k+1]=t;
}
}
}
}
}
void out(int score[5][3],int length)
{
int i;
for(i=0;i<5;i++)
{
printf("%4d",score[i][3]);
}
}