这里还有一个
#define max 10
int min(int a[], int b[])
{ int i;
(a[0] <= a[1]) ? (b[0] = a[0], b[1] = a[1]) : (b[1] = a[0], b[0] = a[1]);
for (i = 2; i < max; ++i)
if (a[i] < b[1])
if (a[i] < b[0])
{ b[1] = b[0];
b[0] = a[i];
}
else
b[1] = a[i];
return 0;
}
int main()
{
int a[max],b[2] = {0,0};
int i;
printf("please input:\n");
for (i = 0; i < max; ++i)
scanf("%d",&a[i]);
min(a,b);
printf("%d,%d\n",b[0],b[1]);
getch();
return 0;
}