Advertisement
Phr0zen_Penguin

ULList.cpp - VTC C++ Data Structures Unsorted Linked List Eg

Apr 19th, 2015
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.50 KB | None | 0 0
  1. /**
  2.  * [ULList.cpp]
  3.  * Unsorted linked list example.
  4.  *
  5.  * compile with:
  6.  * g++ -m32 -static-libgcc -o ullist ULList.cpp UnsortedLinkedList.cpp
  7.  */
  8.  
  9. #include "UnsortedLinkedList.h"
  10.  
  11. int main(void)
  12. {
  13.     /**
  14.      * Unsorted Linked List OBJECT CREATION:
  15.      */
  16.     UnsortedLinkedList  *myUnsortedLinkedList = new UnsortedLinkedList();
  17.  
  18.  
  19.     /**
  20.      * Unsorted Linked List ITEM ADDITION:
  21.      */
  22.     myUnsortedLinkedList->InsertItem(2.3);
  23.     myUnsortedLinkedList->InsertItem(5);
  24.     myUnsortedLinkedList->InsertItem(6);
  25.     myUnsortedLinkedList->InsertItem(1.5);
  26.     myUnsortedLinkedList->InsertItem(1.5);
  27.     myUnsortedLinkedList->InsertItem(2.3);
  28.  
  29.  
  30.     /**
  31.      * Unsorted Linked List ITEM DELETION:
  32.      */
  33.     myUnsortedLinkedList->DeleteItem(2.3);
  34.  
  35.  
  36.     /**
  37.      * Unsorted Linked List OUTPUT:
  38.      */
  39.     std::cout << "ITEMS: " << std::endl;
  40.     myUnsortedLinkedList->Print();
  41.     std::cout << std::endl << "Length: " << myUnsortedLinkedList->LengthIs() << std::endl << std::endl << std::endl;
  42.  
  43.  
  44.     /**
  45.      * Unsorted Linked List ITEM DELETION:
  46.      */
  47.     myUnsortedLinkedList->DeleteItem(1.5);
  48.  
  49.  
  50.     /**
  51.      * Unsorted Linked List OUTPUT:
  52.      */
  53.     std::cout << "ITEMS: " << std::endl;
  54.     myUnsortedLinkedList->Print();
  55.     std::cout << std::endl << "Length: " << myUnsortedLinkedList->LengthIs() << std::endl << std::endl << std::endl;
  56.  
  57.  
  58.     /**
  59.      * Unsorted Linked List ITEM DELETION:
  60.      */
  61.     myUnsortedLinkedList->DeleteItem(5);
  62.  
  63.  
  64.     /**
  65.      * Unsorted Linked List OUTPUT:
  66.      */
  67.     std::cout << "ITEMS: " << std::endl;
  68.     myUnsortedLinkedList->Print();
  69.     std::cout << std::endl << "Length: " << myUnsortedLinkedList->LengthIs() << std::endl << std::endl << std::endl;
  70.  
  71.  
  72.     /**
  73.      * Unsorted Linked List ITEM DELETION:
  74.      */
  75.     myUnsortedLinkedList->DeleteItem(4);
  76.  
  77.  
  78.     /**
  79.      * Unsorted Linked List ITEM DELETION:
  80.      */
  81.     myUnsortedLinkedList->DeleteItem(6);
  82.  
  83.  
  84.     /**
  85.      * Unsorted Linked List OUTPUT:
  86.      */
  87.     std::cout << "ITEMS: " << std::endl;
  88.     myUnsortedLinkedList->Print();
  89.     std::cout << std::endl << "Length: " << myUnsortedLinkedList->LengthIs() << std::endl << std::endl << std::endl;
  90.  
  91.  
  92.     /**
  93.      * Unsorted Linked List ITEM ADDITION:
  94.      */
  95.     myUnsortedLinkedList->InsertItem(25);
  96.     myUnsortedLinkedList->InsertItem(3);
  97.     myUnsortedLinkedList->InsertItem(1.3);
  98.  
  99.  
  100.     /**
  101.      * Unsorted Linked List OUTPUT:
  102.      */
  103.     std::cout << "ITEMS: " << std::endl;
  104.     myUnsortedLinkedList->Print();
  105.     std::cout << std::endl << "Length: " << myUnsortedLinkedList->LengthIs() << std::endl;
  106.  
  107.  
  108.     /**
  109.      * Unsorted Linked List OBJECT DELETION:
  110.      */
  111.     delete myUnsortedLinkedList;
  112.  
  113.     return 0;
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement