Advertisement
bwukki

Untitled

Apr 16th, 2018
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.11 KB | None | 0 0
  1. //main.cpp
  2. #include <iostream>
  3. #include "IntegerSet.h"
  4.  
  5. using namespace std;
  6.  
  7. void test(){
  8.     IntegerSet y{};
  9.     IntegerSet x{};
  10.     cout << "Is x = y? " << x.isEqualTo(y) << endl;
  11.     IntegerSet z{};
  12.     for (int i = 0; i < 100; i++) {
  13.         x.knock(1,i);
  14.         if (i == 5) {x.knock(0,i);}
  15.     }
  16.     x.printSet();
  17.     y.knock(1,5);
  18.     y.printSet();
  19.     cout << "union of set x and y: " << endl;
  20.     x.unionOfSets(y).printSet();
  21.     y.unionOfSets(z).printSet();
  22.     x.intersectionOfSets(y).printSet();
  23.     cout << "x set:";
  24.     x.printSet();
  25.     cout << "y set:";
  26.     y.printSet();
  27.     cout << "z set:";
  28.     y.printSet();
  29.     cout << x.isEqualTo(y) << endl;
  30.     cout << x.isEqualTo(z) << endl;
  31.     //vector<int> test1{0,1,0,1,1,0,1,0,1}; //to work properly, input vector size should = 100 or it will throw an exception, initialize to vector is tested though
  32.     //IntegerSet q{test1};
  33.     //q.printSet();
  34.     cout << "x set:" << endl;
  35.     cout << x.toString() << endl;
  36.     cout << "y set:" << endl;
  37.     cout << y.toString() << endl;
  38.  
  39. }
  40.  
  41.  
  42. int main()
  43. {
  44.     test();
  45.     return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement