### Sorting two arrays to one

Hello, i want to put two arrays in one and arrange it so that it is constantly increasing. The precondition is that both arrays have elements in an increasing order.
This is what I have done so far but I am a bit lost now. Hope you can help me! :)

#include<iostream>
#include<vector>
using namespace std;

vector<double> merge(const vector<double>& v1, const vector<double>& v2) {
int i = 0;
int j = 0;
int k = 0;
int n1 = v1.size();
int n2 = v2.size();
int n3 = n1 + n2;
vector<double> v3(n3);
while (j < n1) {
bool found = false;
if (v1[j] <= v2[k]) {
v3[i] = v1[j];
found = true;
++j;
}
else {
v3[i] = v2[k];
++k;
}
++i;
}
}
return v3;
}

for (int i = 0; i < v.size(); ++i) cin >> v[i];
}

void print_vector(vector<double>& v) {
for (int i = 0; i < v.size(); ++i) cout << v[i] << " ";
}

int main() {
int n1;
cin >> n1;
vector<double> v1(n1);
int n2;
cin >> n2;
vector<double> v2(n2);
vector<double> v3;
v3 = merge(v1, v2);
print_vector(v3);

}
 ``1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253`` ``````#include #include using namespace std; vector merge(const vector& v1, const vector& v2) { vector v3(v1.size() + v2.size()); int i, j, k; i = j = k = 0; while (i < v1.size() && j < v2.size()) { if (v1[i] <= v2[j]) { v3[k] = v1[i]; ++i; } else { v3[k] = v2[j]; ++j; } ++k; } while (i < v1.size()) { v3[k] = v1[i]; ++i; ++k; } while (j < v2.size()) { v3[k] = v2[j]; ++j; ++k; } return v3; } void read_vector(vector& v) { for (int i = 0; i < v.size(); ++i) cin >> v[i]; } void print_vector(vector& v) { for (int i = 0; i < v.size(); ++i) cout << v[i] << " "; } int main() { int n1; cin >> n1; vector v1(n1); read_vector(v1); int n2; cin >> n2; vector v2(n2); read_vector(v2); vector v3; v3 = merge(v1, v2); print_vector(v3); }``````