Adding all elements in a vector with C++
Adding the elements of a vector with a for loop looks
#include <vector>int sum(std::vector<int> nums) { // your code here int sum = 0; for (int i = 0; i < nums.size(); i++) { sum += nums[i]; } return sum;}
However, there's a way to do i