Search
 
SCRIPT & CODE EXAMPLE
 

CPP

accumulate vector c++

//Syntax
accumulate(first, last, sum);
accumulate(first, last, sum, myfun); 

first, last : first and last elements of range 
              whose elements are to be added
sum :  initial value of the sum
myfun : a function for performing any 
        specific task. For example, we can
        find product of elements between
        first and last.
//Example
  int a[] = {5 , 10 , 15} ;
  int res = accumulate(a,a+3,0); // 30
Comment

PREVIOUS NEXT
Code Example
Cpp :: is anagram c++ 
Cpp :: how to make a function in c++ 
Cpp :: break statement in c++ program 
Cpp :: c++ read matttrix from text file 
Cpp :: iostream c++ 
Cpp :: do while c++ 
Cpp :: double array c++ 
Cpp :: how to sort array in c++ 
Cpp :: C++ Calculating the Mode of a Sorted Array 
Cpp :: print hola mundo 
Cpp :: long long int range c++ 
Cpp :: reference c++ 
Cpp :: loop execution descending order in c++ 
Cpp :: c++ get data type 
Cpp :: what is a variable in cpp 
Cpp :: put function in cpp 
Cpp :: google test assert throw 
Cpp :: arduino falling edge 
Cpp :: c++ linked list delete node 
Cpp :: 2d array of zeros c++ 
Cpp :: how to find size of int in c++ 
Cpp :: first and last digit of a number in c++ 
Cpp :: c++ function pointer as variable 
Cpp :: hashset in cpp 
Cpp :: vector size c++ 
Cpp :: remove elements from vector 
Cpp :: char input in c++ 
Cpp :: recuva recovery software for pc with crack 
Cpp :: unambiguous 
Cpp :: full pyramid in c++ 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =