Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
GetSum is a container code snippet to sum all values in a one-dimensional container. To sum all values in a two-dimensional matrix, go to the GetSum (on matrix) page.
There are multiple ways to perform GetSum:
#include <algorithm> |
This version is given as the answer of Exercise #9: No for-loops.
#include <algorithm> |
Prefer algorithms over loops [1,2].
#include <vector> |
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.