该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
# include
#define N 9
void fun(int a[], int n)
{ int i,j, max, min, px, pn, t;
for (i=0; i
{
/**********found**********/
max = min = ___a[i]__;
px = pn = i;
for (j=i+1; j
/**********found**********/
if (max<___a>
{ max = a[j]; px = j; }
/**********found**********/
if (min>___a[j]___)
{ min = a[j]; pn = j; }
}
if (pn != i)
{ t = a[i]; a[i] = min; a[pn] = t;
if (px == i) px =pn;
}
if (px != i+1)
{ t = a[i+1]; a[i+1] = max; a[px] = t; }
}
}
main()
{ int b[N]={9,1,4,2,3,6,5,8,7}, i;
printf("\nThe original data :\n");
for (i=0; i
printf("\n");
fun(b, N);
printf("\nThe data after moving :\n");
for (i=0; i
printf("\n");
}