Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

sum of vector elements C++

#include<numeric>

vector<int> pack = {1,2,3} ;

int sum = accumulate(pack.begin(),pack.end(),0) ;    ////****

cout << sum ;  	// 6
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #sum #vector #elements
ADD COMMENT
Topic
Name
5+1 =