有两个数组CLevePoint* m_pKsum;CLevePoint* m_pUsum;
如何将这两个数组合并到数组CLevePoint* m_psum;中
有两个数组CLevePoint* m_pKsum;CLevePoint* m_pUsum;
如何将这两个数组合并到数组CLevePoint* m_psum;中
#include <iostream>
using namespace std;
int main() {
int a[3], b[3], c[6];
for(int i = 0; i < 3; i++) {
cin >> a[i];
}
for(int i = 0; i < 3; i++) {
cin >> b[i];
}
int i = 0, j = 0, index = 0;
while(i < 3 && j < 3) {
if(a[i] < b[j]) {
c[index++] = a[i++];
}else {
c[index++] = b[j++];
}
}
while(i < 3) {
c[index++] = a[i++];
}
while(j < 3) {
c[index++] = b[j++];
}
for(int i = 0; i < 5; i++) {
cout << c[i] << " ";
}
cout << c[5] << endl;
return 0;
}