Advertisement
tomasaccini

Untitled

Jul 19th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. #include <list>
  2.  
  3. template<typename T>
  4. std::list<T> SinSegunda(std::list<T> a, std::list<T> b) {
  5.     std::list<T> nueva_lista;
  6.     typename std::list<T>::iterator it_a = a.begin();
  7.     typename std::list<T>::iterator it_b;
  8.     bool esta;
  9.     while ( it_a != a.end() ) {
  10.         esta = false;
  11.         it_b = b.begin();
  12.         while ( it_b != b.end() ) {
  13.             if (*it_a == *it_b) {
  14.                 esta = true;
  15.                 break;
  16.             }
  17.             ++it_b;
  18.         }
  19.         if (!esta) {
  20.             nueva_lista.push_back(*it_a);
  21.         }
  22.         ++it_a;
  23.     }
  24.     return nueva_lista;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement