Lowest price ever! Learn Generative AI for 48% less!
Get my discount+ 1
There is not a sum function in the std library but you have std::accumulate located in algorithm.h.
You could also do your own sum function or variable, which doesnt need to be int. A variable named sum stores the type you want it to store, same with functions and function return types.