MaximCherchuk

transform

Nov 7th, 2015
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     vector<int> a{1, 2, 3, 4, 5};
  7.     vector<int> b{5, 4, 3, 2, 1};
  8.     transform(a.begin(), a.end(), b.begin(), a.begin(), [](int a1, int a2) { return a1 - a2; });
  9.     for(int i : a) cout << i << ' ';
  10. }
Advertisement
Add Comment
Please, Sign In to add comment