Advertisement
sellmmaahh

tut5-zad2

Jul 21st, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <vector>
  4.  
  5. template <typename It1, typename It2>
  6. It2 RazmijeniBlokove (It1 p1, It1 p2, It2 p3)
  7. {
  8.     while (*p1!=*p2) std::swap (*p1++, *p3++);
  9.     return p3;
  10. }
  11. template <typename tip>
  12. tip Ispisi(const tip &a)
  13. {
  14.     for (auto x: a)
  15.         std::cout<<x<<" ";
  16.  
  17. }
  18.  
  19. int main () {
  20.      std::string a{1,2,3,4,5,6,7}, b{9,9,9,9,9,9,9,9,9};
  21.     RazmijeniBlokove(a.begin(), a.end(), b.begin());
  22.  
  23.  
  24. Ispisi(a);
  25. Ispisi(b);
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement