序列排序后{3,4,5,2,1,6,8,9,7}
#include <stdio.h> jsValue(int a[10][9]) { int i,j,c=0,b[9],k,temp,first; for(i=0;i<10;i++) { first=a[0][0]; for(j=1;j<9;j++) { if(a[i][j]>first) ; else { temp=a[i][j]; k=j; do{a[i][j]=a[i][j-1]; j--; }while(j!=(-1)); a[i][0]=temp; j=k; } } } } main() { int a[10][9]={{6,8,9,1,2,5,4,7,3}, {3,5,8,9,1,2,6,4,7}, {8,2,1,9,3,5,4,6,7}, {3,5,1,2,9,8,6,7,4}, {4,7,8,9,1,2,5,3,6}, {4,7,3,5,1,2,6,8,9}, {9,1,3,5,8,6,2,4,7}, {2,6,1,9,8,3,5,7,4}, {5,3,7,9,1,8,2,6,4}, {7,1,3,2,5,8,9,4,6},}; int i,j; jsValue(a); for(i=0;i<10;i++) { for(j=0;j<9;j++) { printf("%d",a[i][j]); if(j<=7) printf(","); } printf("\n"); } writeDat(a); } writeDat(int a[10][9]) { FILE *fp; int i,j; fp=fopen("OUT62.DAT","w"); for(i=0;i<10;i++) { for(j=0;j<9;j++) { fprintf(fp,"%d",a[i][j]); if(j<=7) fprintf(fp,","); } fprintf(fp,"\n"); } fclose(fp); }