【填空题】补充完成以下函数功能,返回数组a中的第n大元素的值 int fun(int a[], int s, int n) { const int MININT = -10000; int i, j, max, index; for (i = 0; i < n; ++i) { max = MININT; for (j = i; j < s; ++j) if (a[j] > __(1)___) { max = a[j]; index = j; } a[index] = a[i]; a[i] = __(2)_____; } return max; }
【填空题】补充完成以下函数功能,返回数组a中的第n大元素的值 int fun(int a[], int s, int n) { const int MININT = -10000; int i, j, max, index; for (i = 0; i < n; ++i) { max = MININT; for (j = i; j < s; ++j) if (a[j] > __(1)___) { max = a[j]; index = j; } a[index] = a[i]; a[i] = __(2)_____; } return max; }
1