Comulative sum in C++

Hlo freinds how to calculate a comulative sum of given integers in C++?
is there a way?

Store the first element in the csum array and then add every next element to the previous index of the the array and store it.