concatenate two vectors c 2b 2b

Solutions on MaxInterview for concatenate two vectors c 2b 2b by the best coders in the world

showing results for - "concatenate two vectors c 2b 2b"
Daniel
01 Feb 2018
1#include <vector> // vector 
2#include <iostream> // output 
3using namespace std;
4
5int main()
6{
7  // two vectors to concatenate
8  vector<int> A = {1,3,5,7};
9  vector<int> B = {2,4,6,8};
10  // vector that will hold the combined values of A and B
11  std::vector<int> AB = A;
12  AB.insert(AB.end(), B.begin(), B.end());
13  // output 
14  for (auto i : AB) {
15      cout << i << ' ';
16  }
17}