// File: HLtest1.cpp // #include #include "HList.h" #include "IntNode.h" using namespace std ; int main() { HList List1; for(int i = -5; i < 10; i+=2) { List1.push_back(new IntNode(i) ); } List1.print(); cout << endl << endl; List1.push_back(new IntNode(8)) ; List1.pop_front() ; List1.print(); cout << endl << endl; List1.remove(IntNode(7)) ; List1.remove(IntNode(3)) ; List1.remove(IntNode(8)) ; List1.print(); cout << endl << endl; List1.remove(IntNode(-3)) ; List1.remove(IntNode(1)) ; List1.print(); cout << endl << endl; cout << "front = " ; List1.front()->print() ; cout << endl << endl; cout << "back = " ; List1.back()->print() ; cout << endl << endl; cout << "find 5: " ; List1.find(IntNode(5))->print() ; cout << "\nsize = " << List1.size() << "\n\n" ; List1.pop_front() ; List1.pop_front() ; List1.pop_front() ; List1.print() ; cout << endl << endl; if (List1.front() == NULL) cout << "Good that front() is NULL\n" ; if (List1.back() == NULL) cout << "Good that back() is NULL\n" ; List1.push_front(new HNode) ; List1.push_front(new HNode) ; List1.push_front(new HNode) ; List1.print() ; cout << "\nsize = " << List1.size() << "\n" ; List1.push_front(new IntNode(101)) ; List1.push_back(new IntNode(999)) ; List1.print() ; cout << "\nsize = " << List1.size() << "\n\n" ; cout << "front = " ; List1.front()->print() ; cout << endl << endl; cout << "back = " ; List1.back()->print() ; cout << endl << endl; }