Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <stdexcept>
- #include <functional>
- using namespace std;
- template < typename T, typename FunkTip>
- auto Fja(T x,FunkTip f, int n)->decltype (x)
- {
- auto rez=f(x);
- for (int i=1; i<=n; i++) {
- rez=f(rez);
- }
- return rez;
- }
- int main () {
- cout<<Fja(10, [] (int x) {return 3*x*x-5;} ,5);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement