Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * [SLList.cpp]
- * Sorted linked list example.
- *
- * compile with:
- * g++ -m32 -static-libgcc -o sllist SLList.cpp SortedLinkedList.cpp
- */
- #include "SortedLinkedList.h"
- int main(void)
- {
- /**
- * Sorted Linked List OBJECT CREATION:
- */
- SortedLinkedList *mySortedLinkedList = new SortedLinkedList();
- /**
- * Sorted Linked List ITEM ADDITION:
- */
- mySortedLinkedList->InsertItem(7);
- mySortedLinkedList->InsertItem(2);
- mySortedLinkedList->InsertItem(6);
- /**
- * Sorted Linked List OUTPUT:
- */
- std::cout << "ITEMS: " << std::endl;
- mySortedLinkedList->Print();
- std::cout << std::endl << "LENGTH: " << mySortedLinkedList->LengthIs() << std::endl << std::endl << std::endl;
- /**
- * Sorted Linked List ITEM ADDITION:
- */
- mySortedLinkedList->InsertItem(1.5);
- mySortedLinkedList->InsertItem(2.6);
- mySortedLinkedList->InsertItem(1.5);
- /**
- * Sorted Linked List OUTPUT:
- */
- std::cout << "ITEMS: " << std::endl;
- mySortedLinkedList->Print();
- std::cout << std::endl << "LENGTH: " << mySortedLinkedList->LengthIs() << std::endl << std::endl << std::endl;
- /**
- * Sorted Linked List ITEM DELETION:
- */
- mySortedLinkedList->DeleteItem(1.5);
- /**
- * Sorted Linked List OUTPUT:
- */
- std::cout << "ITEMS: " << std::endl;
- mySortedLinkedList->Print();
- std::cout << std::endl << "LENGTH: " << mySortedLinkedList->LengthIs() << std::endl << std::endl << std::endl;
- /**
- * Sorted Linked List ITEM ADDITION:
- */
- mySortedLinkedList->InsertItem(2.6);
- /**
- * Sorted Linked List ITEM DELETION:
- */
- mySortedLinkedList->DeleteItem(2.6);
- /**
- * Sorted Linked List OUTPUT:
- */
- std::cout << "ITEMS: " << std::endl;
- mySortedLinkedList->Print();
- std::cout << std::endl << "LENGTH: " << mySortedLinkedList->LengthIs() << std::endl;
- /**
- * Sorted Linked List OBJECT DELETION:
- */
- delete mySortedLinkedList;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment