Advertisement
amermo

Samostalni 5 - Z22

Apr 2nd, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. template <typename TipElemenata, typename TipFunkcije>
  5. std::vector<TipElemenata> UzastopnaFunkcija(TipElemenata x, TipFunkcije f, int n)
  6. {
  7.     std::vector<TipElemenata> Rezultat;
  8.     if(n == 0)
  9.         Rezultat.push_back(x);
  10.     else
  11.     {
  12.         Rezultat.push_back(f(x));
  13.         for(int i(1); i < n; i++)
  14.             Rezultat.push_back(f(Rezultat[i-1]));
  15.     }
  16.     return Rezultat;
  17. }
  18.  
  19. int main()
  20. {
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement