Advertisement
sellmmaahh

Untitled

Aug 1st, 2015
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <stdexcept>
  4. #include <string>
  5. #include <vector>
  6.  
  7. using namespace std;
  8.  
  9. template<typename PokTip, typename TipEl>
  10. PokTip Maximum (PokTip It1, PokTip It2, TipEl f (TipEl)) {
  11. auto max{It1};
  12. It1++;
  13. while (It1!=It2)
  14. {
  15. if (f(*It1)>f(*max))
  16. max=It1;
  17. It1++;
  18. }
  19. return max;
  20. }
  21. int main () {
  22. int niz[10]={2,4,6,1,6,8,6,3,1,7};
  23. auto pok{Maximum(niz, niz+10, sin)};
  24. cout<<*pok;
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement