int a[] = {34,6,41,58,0,12,89,-2,45,25};
int i, pass, hold;
for(pass = 1; pass <= (a.length-1); pass++)
for(i = 0; i <= (a.length-2); i++)
if(a[i] > a[i + 1])
{
hold = a[i];
a[i] = a[i + 1];
a[i + 1] = hold;
}
for(int i1=0;i1<10;i1++){
Toast.makeText(getApplicationContext(), ""+a[i1],Toast.LENGTH_SHORT).show();
}
沒有留言:
張貼留言