Advertisement
Guest User

Untitled

a guest
Dec 20th, 2014
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. template <class T> CSet<T> operator+(const CSet<T> & a, const CSet<T> & b) {
  2. CSet<T> x;
  3. int size = a.iSize;
  4. for (int i = 0; i < b.iSize; i++) {
  5. if (!(a.iSearch(b.vSet[i]))) {
  6. size++;
  7. }
  8. }
  9. x.vSet = new T[size];
  10. x.iCapacity = size;
  11. x.iSize = size;
  12. for (int i = 0; i < a.iSize; i++) {
  13. x.vSet[i] = a.vSet[i];
  14. cout << "x " << x.vSet[i] << endl;
  15. }
  16. int temp = a.iSize;
  17. for (int i = 0; i < b.iSize; i++) {
  18. if (!(x.iSearch(b.vSet[i]))) {
  19. x.vSet[temp] = b.vSet[i];
  20. cout << "x " << x.vSet[temp] << endl;
  21. temp++;
  22. }
  23. }
  24. return x;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement