首页 > 试题广场 >

#include using names...

[填空题]
#include <iostream>
using namespace std;
void func(int ary[], int n) {
    int i = 0, j, x;
    j = n - 1;
    while (i < j) {
        while (i < j && ary[i] > 0) i++;
        while (i < j && ary[j] < 0) j--;
        if (i < j) {
            x = ary[i];
            ary[i++] = ary[j];
            ary[j--] = x;
        }
    }
}
int main(void) {
    int a[20], i, m;
    m = 10;
    for (i = 0; i < m; i++) {
        cin >> a[i];
    }
    func(a, m);
    for (i = 0; i < m; i++)
        cout << a[i] << " ";
    cout << endl;
    return 0;
}


输入:5 4 -6 -11 6 -59 22 -6 1 10

输出:____________________________________

关于填空题不能填空这件事
发表于 2022-08-23 19:26:25 回复(1)
皇帝的新题
发表于 2021-08-18 14:53:48 回复(1)
这道题怎么填空

发表于 2022-08-26 08:55:56 回复(0)
R_S头像 R_S
5 4 10 1 6 22 -59 -6 -11 -6 
发表于 2021-08-18 17:37:23 回复(0)