Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- template <typename Tip1, typename Tip2>
- Tip2 KopirajBezDuplikata(Tip1 It1, Tip1 It2, Tip2 It3)
- { Tip1 poc=It1;
- while (It1!=It2) {
- bool ImaGa(false);
- Tip1 p=poc;
- while (p!=It2) {
- if (*p==*It1) {
- ImaGa=true;
- break;
- }
- p++;
- }
- if (!ImaGa) {
- *It3=*It1;
- It3++;
- }
- It1++;
- }
- return It3;
- }
- int main () {
- string s1,rez;
- cout<<"Unesite recenicu: ";
- getline(cin, s1);
- auto p=KopirajBezDuplikata(s1.begin(), s1.end(),rez.begin());
- for (int i=0; i<rez.length(); i++) cout<<rez[i];
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement