Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- #include <functional>
- using namespace std;
- int main2()
- {
- int a = 10;
- auto test = [&a](int b)
- {
- a += 5;
- b += a;
- return b;
- };
- cout << a << " " << test(25) << "\n";
- return 0;
- }
- int main3()
- {
- vector<int> v;
- for (int index = 0; index < 5; ++index)
- {
- int x;
- cin >> x;
- v.push_back(x);
- }
- sort(v.begin(), v.end(), [](int x, int y) {return x > y;});
- for (int index = 0; index < 5; ++index)
- cout << v[index] << ' ';
- v.clear();
- return 0;
- }
- int main()
- {
- int x = 5, y = 10;
- function<int(void)> f = [&x, y]() {return x + y;};
- x += 5;
- y += 5;
- cout << f();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement