Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * [ULList.cpp]
- * Unsorted linked list example.
- *
- * compile with:
- * g++ -m32 -static-libgcc -o ullist ULList.cpp UnsortedLinkedList.cpp
- */
- #include "UnsortedLinkedList.h"
- int main(void)
- {
- /**
- * Unsorted Linked List OBJECT CREATION:
- */
- UnsortedLinkedList *myUnsortedLinkedList = new UnsortedLinkedList();
- /**
- * Unsorted Linked List ITEM ADDITION:
- */
- myUnsortedLinkedList->InsertItem(2.3);
- myUnsortedLinkedList->InsertItem(5);
- myUnsortedLinkedList->InsertItem(6);
- myUnsortedLinkedList->InsertItem(1.5);
- myUnsortedLinkedList->InsertItem(1.5);
- myUnsortedLinkedList->InsertItem(2.3);
- /**
- * Unsorted Linked List ITEM DELETION:
- */
- myUnsortedLinkedList->DeleteItem(2.3);
- /**
- * Unsorted Linked List OUTPUT:
- */
- std::cout << "ITEMS: " << std::endl;
- myUnsortedLinkedList->Print();
- std::cout << std::endl << "Length: " << myUnsortedLinkedList->LengthIs() << std::endl << std::endl << std::endl;
- /**
- * Unsorted Linked List ITEM DELETION:
- */
- myUnsortedLinkedList->DeleteItem(1.5);
- /**
- * Unsorted Linked List OUTPUT:
- */
- std::cout << "ITEMS: " << std::endl;
- myUnsortedLinkedList->Print();
- std::cout << std::endl << "Length: " << myUnsortedLinkedList->LengthIs() << std::endl << std::endl << std::endl;
- /**
- * Unsorted Linked List ITEM DELETION:
- */
- myUnsortedLinkedList->DeleteItem(5);
- /**
- * Unsorted Linked List OUTPUT:
- */
- std::cout << "ITEMS: " << std::endl;
- myUnsortedLinkedList->Print();
- std::cout << std::endl << "Length: " << myUnsortedLinkedList->LengthIs() << std::endl << std::endl << std::endl;
- /**
- * Unsorted Linked List ITEM DELETION:
- */
- myUnsortedLinkedList->DeleteItem(4);
- /**
- * Unsorted Linked List ITEM DELETION:
- */
- myUnsortedLinkedList->DeleteItem(6);
- /**
- * Unsorted Linked List OUTPUT:
- */
- std::cout << "ITEMS: " << std::endl;
- myUnsortedLinkedList->Print();
- std::cout << std::endl << "Length: " << myUnsortedLinkedList->LengthIs() << std::endl << std::endl << std::endl;
- /**
- * Unsorted Linked List ITEM ADDITION:
- */
- myUnsortedLinkedList->InsertItem(25);
- myUnsortedLinkedList->InsertItem(3);
- myUnsortedLinkedList->InsertItem(1.3);
- /**
- * Unsorted Linked List OUTPUT:
- */
- std::cout << "ITEMS: " << std::endl;
- myUnsortedLinkedList->Print();
- std::cout << std::endl << "Length: " << myUnsortedLinkedList->LengthIs() << std::endl;
- /**
- * Unsorted Linked List OBJECT DELETION:
- */
- delete myUnsortedLinkedList;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement