avukas

peti sa sedmog

May 2nd, 2014
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include <iostream>
  2. #include<functional>
  3. #include<cmath>
  4.  
  5.  
  6.  
  7. int f(int x){
  8. return x*2;
  9. }
  10.  
  11. std::function<int(int)> funkcija(int f(int), int n){
  12. return[f,n](int x){
  13.  
  14.     for(int i=0; i<n-1; i++)
  15.         x=f(x);
  16.      return f(x);
  17. };
  18. }
  19.  
  20. int main()
  21. {
  22.     int n;
  23.     std::cin >> n;
  24.     auto fun3(funkcija(f,n )(1));
  25.     std::cout << fun3;
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment