Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <functional>
- int main()
- {
- std::function<int(int)> fib = [&fib](int n) {return n < 2 ? 1 : fib(n-1) + fib(n-2);};
- std::cout << fib(9) << std::endl;
- return EXIT_SUCCESS;
- }
Add Comment
Please, Sign In to add comment