Cpp Vector Push Back Another Vector Code Example
Example 1: how to append one vector to another c++
vector a;
vector b;
// Appending the integers of b to the end of a
a.insert(a.end(), b.begin(), b.end());
Example 2: how to append to a vector c++
//vector.push_back is the function. For example, if we want to add
//3 to a vector, it is just vector.push_back(3)
vector vi;
vi.push_back(1); //[1]
vi.push_back(2); //[1,2]
Comments
Post a Comment