I have a vector with an arbitrary number of doubles. For a class project, we are scanning for "pulses" or spikes in the values of these numbers and then need to compute the area of them by summing the numbers in a particular range.
I can do this using a simple for loop, however, our professor challenged us to use built in algorithms where possible. Reading over the various members in the algorithm class at cplusplus.com I am a little lost. Anybody able to please give me an example of how something like this could be done or point me to documentation that may be helpful in narrowing down my search?
Basically looking for a way to use one of the built-in algorithms to iterate through a vector, summing up adjacent values, and returning the total. I will pass the start and end position in the vector.
Lambda's are permitted, as well, though I am not very familiar with them. Seems like they could be useful for something like this, though.