📅  最后修改于: 2022-03-11 14:44:51.041000             🧑  作者: Mango
#include // Accumulate
#include // Vector
using namespace std;
int main()
{
vector nums{1,2,3,4,5};
int sum = 0;
sum = accumulate(nums.begin(), nums.end(), sum);
// nums.begin() -> first number in a list
// nums.end() -> last number in a list
// sum -> starting value before accumulating: Here its 0
}