Advertisement
Neveles

Untitled

Feb 16th, 2020
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.17 KB | None | 0 0
  1.     cout << "<FIRST TEST>" << endl;
  2.     List mainList;
  3.     mainList += 1;
  4.     mainList += 2;
  5.     mainList += 3;
  6.     mainList += 4;
  7.     mainList += 5;
  8.     mainList += 6;
  9.     mainList += 7;
  10.     mainList += 8;
  11.     mainList += 9;
  12.     mainList += 0;
  13.     cout << "Main list before merge:" << endl << mainList << endl;
  14.  
  15.     List mergedList;
  16.     mergedList += 5;
  17.     mergedList += 7;
  18.     mergedList += 1;
  19.     mergedList += 0;
  20.     mergedList += 3;
  21.     mergedList += 63;
  22.     mergedList += 4;
  23.     mergedList += 3;
  24.     mergedList += 5;
  25.     mergedList += 43;
  26.     cout << "Merged list before merge:" << endl << mergedList << endl;
  27.  
  28.     if (mainList == mergedList)
  29.     {
  30.         cout << "Main and merge lists are equal" << endl;
  31.     }
  32.     else
  33.     {
  34.         cout << "Main and merge lists are not equal" << endl;
  35.     }
  36.  
  37.     List andList = (mainList & mergedList);
  38.     List orList = (mainList | mergedList);
  39.     mergedList.merge(mainList);
  40.  
  41.     cout << endl << "User list after merge:" << endl << mainList << endl;
  42.     cout << "Merged list after merge:" << endl << mergedList << endl;
  43.     cout << "And list:" << endl << andList << endl;
  44.     cout << "Or list:" << endl << orList << endl;
  45.  
  46.     cout << endl << endl << "<SECOND TEST>" << endl;
  47.     List mainListNo2;
  48.     mainListNo2 += 56;
  49.     mainListNo2 += 21;
  50.     mainListNo2 += 0;
  51.     mainListNo2 += 3;
  52.     mainListNo2 += 8;
  53.     mainListNo2 += -14;
  54.     mainListNo2 += 76;
  55.     mainListNo2 += -9;
  56.     mainListNo2 += 0;
  57.     mainListNo2 += 3;
  58.     cout << "Main list before merge:" << endl << mainListNo2 << endl;
  59.  
  60.     List mergedListNo2;
  61.     mergedListNo2 += -45;
  62.     mergedListNo2 += 7;
  63.     mergedListNo2 += 1;
  64.     mergedListNo2 += 0;
  65.     mergedListNo2 += 8;
  66.     mergedListNo2 += 5;
  67.     mergedListNo2 += 2;
  68.     mergedListNo2 += -35;
  69.     mergedListNo2 += 8;
  70.     mergedListNo2 += 3;
  71.     cout << "Merged list before merge:" << endl << mergedListNo2 << endl;
  72.  
  73.     if (mainListNo2 == mergedListNo2)
  74.     {
  75.         cout << "Main and merge lists are equal" << endl;
  76.     }
  77.     else
  78.     {
  79.         cout << "Main and merge lists are not equal" << endl;
  80.     }
  81.  
  82.     List andListNo2 = (mainListNo2 & mergedListNo2);
  83.     List orListNo2 = (mainListNo2 | mergedListNo2);
  84.     mergedListNo2.merge(mainListNo2);
  85.  
  86.     cout << endl << "User list after merge:" << endl << mainListNo2 << endl;
  87.     cout << "Merged list after merge:" << endl << mergedListNo2 << endl;
  88.     cout << "And list:" << endl << andListNo2 << endl;
  89.     cout << "Or list:" << endl << orListNo2 << endl;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement