I'll teach you how to add up all elements in a vector. The manual way loops through with int sum = 0; for(int x : v) sum += x; which accumulates each value. This works but requires three lines.
The STL way uses accumulate(v.begin(), v.end(), 0) from the numeric library which returns the sum in one call. The third argument is the starting value, usually 0 for sums or 1 for products.
For products, use accumulate(v.begin(), v.end(), 1, multiplies()). Always include numeric for accumulate or you get a compilation error.