vendredi 4 mai 2018

Sum Array element using Accumulate function in C++

I wants to get the sum of array elements using Accumulate Function in C++.

Here is my code:-

long long arrA[5]={1,2,3,4,5};
long long sum=accumulate(begin(arrA),end(arrA),0);
cout<<sum<<endl;

This Code return error in accumulate function. How can I do this???

Aucun commentaire:

Enregistrer un commentaire