#include <iostream> using n
#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()
{
int a[20], i, m;
m=10;
for(i=0; i<m; i++)
{
in>>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
输出: ___________________________________
答案
第1空:5 4 10 1 6 22 -59 -6 -11 -6