C++ 问题 merge怎么用,我的程序那里问题
程序代码:
#include <iostream> #include <algorithm> #include <vector> using namespace std; void print(int i) { cout<<i<<" "; } int main () { int a[]={5,6,3,1,5,2,7,8,9}; vector<int> LA(a,a+9); int b[]={1,4,5,87,9,4,6,45,6,4,88,8}; vector<int> LB(b,b+12); vector<int> LC; for_each(LA.begin(),LA.end(),print); cout<<endl; for_each(LB.begin(),LB.end(),print); cout<<endl; merge(LA.begin(),LA.end(),LB.begin(),LB.end(),LC.begin()); sort(LC.begin(),LC.end()); for_each(LC.begin(),LC.end(),print); return 0; }