假设数组有10个数#include int main(){int a[10]={1,2,3,4,5,6,7,8,9,10};int i,j,t;for(i=1;i<10;i++){for(j=0;j<10-i;j++){if (a[j]>a[j+1]){t=a[j];a[j]=a[j+1];a[j+1]=t;}for(int k=0;k<10;k++){printf("%4d\n",a[k]);}}}}