#include <stdio.h>
#include <stdlib.h>
typedef int Item;
#define key(A) (A)
#define less(A, B) (data[A] < data[B])
#define more(A, B) (data[A] > data[B])
#define exch(A, B) {Item t = A; A = B; B = t;}
#define compexch(A, B) if (less(B, A)) exch(A, B)
int main(void)
{
int data[10] = {1, 3, 8, 7, 9, 9, 4, 6, 8, 10};
int a[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
int i, j, min;
for (i = 0; i < 9; i++)
{
min = i;
for(j = i + 1; j <= 9; j++)
{
if (more(a[j], a[min]))
min = j;
}
exch(a[i], a[min]);
}
/*
*
自己循环下吧。
*/
getchar();
return 0;
}