Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- #include <functional>
- #include <iostream>
- #include <iterator>
- #include <numeric>
- #include <vector>
- using namespace std;
- int main() {
- vector<int> v = {1, 2, 3, 4, 5};
- for (int& e: v) cout << e << ' '; cout << endl;
- cout << "Accumulate: " << accumulate(v.begin(), v.end(), 0) << endl;
- vector<int> u = {10, 20, 30, 40, 50};
- vector<int> x;
- x.resize(v.size());
- transform(v.begin(), v.end(), u.begin(), x.begin(), plus<int>());
- for (int& e: x) cout << e << ' '; cout << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement