int[] array={.........};
int temp=0;
for(int i=0;i
for(int j=1;j
if(array[j]
temp=array[j];
array[i]=array[j];
array[j]=temp;
}
}
}
int[] aa = { 1,5,2,3,7 };
int temp;
for (int i = 0; i < aa.Length; i++)
{
for (int j = 0; j < aa.Length-i-1;j++ )
{
if(aa[j+1]
temp = aa[j];
aa[j]=aa[j+1];
aa[j + 1] = temp;
}
}
}
for (int i = 0; i < aa.Length;i++ )
{
textBox1.Text += aa[i];
}
这是从小到大顺序排列,如果要从大到小排列只需将地7行的<改为>即可