Answers for "sum two vectors c++"

4

sum vector c++

vector<int> v{1,2,3,4,5,6,7,8,9};
  int sum = 0;
//Method 1:
  sum = accumulate(v.begin(), v.end(), 0);
//Method 2: 
  for(auto& i : v) sum+=i;
Posted by: Guest on June-05-2021
0

concat two vectors c++

std::vector<int> first;
std::vector<int> second;

first.insert(first.end(), second.begin(), second.end());
Posted by: Guest on February-22-2022
-2

how to append two vectors in c++

std::vector<int> AB = A;
AB.insert(AB.end(), B.begin(), B.end());
Posted by: Guest on June-16-2020

Code answers related to "sum two vectors c++"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language