Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <functional>
- using namespace std;
- int f(int x)
- {
- return x +2;
- }
- function<int(int)> IteriranaFunkcija(int f(int), int n)
- {
- return [f,n] (double x) {int i(0); while(i < n){x = f(x);i++;} return x;};
- }
- int main()
- {
- auto g(IteriranaFunkcija(f, 2));
- cout << g(5);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement