Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <algorithm>
- using namespace std;
- template <typename TipPok>
- auto SumaBloka(TipPok p1, TipPok p2)-> decltype (*p1+*p2) {
- decltype (*p1+*p2) suma=0;
- while (p1!=p2) {
- suma+=*p1;
- p1++;
- }
- return suma;
- }
- int main () {
- vector<int> vek{2,3,4,2,2};
- cout<<SumaBloka(vek.begin(), vek.end());
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement