C++ question: How can I print three separate results? The vector A, then in anot
ID: 3915046 • Letter: C
Question
C++ question: How can I print three separate results? The vector A, then in another line the vector B, then finally in another line the final merge. It keeps giving me the result in separate lines. Can you please show me your result if it works? thanks! Thanks
#include <iostream>
#include <vector>
using namespace std;
vector<int> append(vector<int> a, vector<int> b){
vector<int> merge;
for (int i = 0; i < a.size(); i++){
cout.merge[i];
merge.push_back(a[i]);
}
for (int i = 0; i < b.size(); i++){
merge.push_back(b[i]);
}
return merge;
}
int main(){
vector<int> a = {1, 2, 3, 4};
cout<<result.at(i);
vector<int> b = {5, 6, 7, 8, 9};
vector<int> result = append(a, b);
for (int i = 0; i < result.size(); i++){
cout << result.at(i) << " ";
}
cout<<endl;
}