Advertisement
sellmmaahh

prva-parc-2014-zad5

Jul 29th, 2015
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4.  
  5.  
  6. using namespace std;
  7.  
  8. template <typename Tip1, typename Tip2>
  9. Tip2 KopirajBezDuplikata(Tip1 It1, Tip1 It2, Tip2 It3)
  10. {  Tip1 poc=It1;
  11. while (It1!=It2) {
  12.     bool ImaGa(false);
  13.     Tip1 p=poc;
  14.     while (p!=It2) {
  15.         if (*p==*It1) {
  16.             ImaGa=true;
  17.             break;
  18.         }
  19.         p++;
  20.     }
  21.     if (!ImaGa) {
  22.         *It3=*It1;
  23.         It3++;
  24.     }
  25.     It1++;
  26.  
  27.  
  28. }
  29. return It3;
  30. }
  31.  
  32.  
  33. int main () {
  34.     string s1,rez;
  35.     cout<<"Unesite recenicu: ";
  36.     getline(cin, s1);
  37.     auto p=KopirajBezDuplikata(s1.begin(), s1.end(),rez.begin());
  38.     for (int i=0; i<rez.length(); i++) cout<<rez[i];
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement