#include <iostream>
using namespace std;
int Union(int A[], int n, int B[], int m, int C[]) //合并A[n]和B[m]
{
int i = 0, j = 0, k = 0;
while(i<n && j<m)
{
if (A[i]<=B[j])
C[k++] = A[i++]; //A[i]与B[j]中较小者存入C[k]
else
C[k++] = B[j++];
}
while (i<n)
C[k++] = A[i++]; //收尾处理
while (j<m)
C[k++] = B[j++];
return C[6];
}
int main()
{
int a[3] = {1, 4, 5};
int b[3] = {2, 3, 7};
int c[6];
Union(a, 3, b, 3, c);
cout<<c[1]<<c[2]<<c[3]<<c[4]<<c[0]<<c[5]<<endl;
system("pause");
return 0;
}