Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<functional>
- #include<cmath>
- int f(int x){
- return x*2;
- }
- std::function<int(int)> funkcija(int f(int), int n){
- return[f,n](int x){
- for(int i=0; i<n-1; i++)
- x=f(x);
- return f(x);
- };
- }
- int main()
- {
- int n;
- std::cin >> n;
- auto fun3(funkcija(f,n )(1));
- std::cout << fun3;
- }
Advertisement
Add Comment
Please, Sign In to add comment