Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <stdexcept>
- #include <string>
- #include <vector>
- using namespace std;
- template<typename PokTip, typename TipEl>
- PokTip Maximum (PokTip It1, PokTip It2, TipEl f (TipEl)) {
- auto max{It1};
- It1++;
- while (It1!=It2)
- {
- if (f(*It1)>f(*max))
- max=It1;
- It1++;
- }
- return max;
- }
- int main () {
- int niz[10]={2,4,6,1,6,8,6,3,1,7};
- auto pok{Maximum(niz, niz+10, sin)};
- cout<<*pok;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement