Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <class T> CSet<T> operator+(const CSet<T> & a, const CSet<T> & b) {
- CSet<T> x;
- int size = a.iSize;
- for (int i = 0; i < b.iSize; i++) {
- if (!(a.iSearch(b.vSet[i]))) {
- size++;
- }
- }
- x.vSet = new T[size];
- x.iCapacity = size;
- x.iSize = size;
- for (int i = 0; i < a.iSize; i++) {
- x.vSet[i] = a.vSet[i];
- cout << "x " << x.vSet[i] << endl;
- }
- int temp = a.iSize;
- for (int i = 0; i < b.iSize; i++) {
- if (!(x.iSearch(b.vSet[i]))) {
- x.vSet[temp] = b.vSet[i];
- cout << "x " << x.vSet[temp] << endl;
- temp++;
- }
- }
- return x;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement