Code /* TestTList.cpp CIS 250 David Klick 2009-02-23 Test driver for templated tlist class. */ #include "tlist.h" #include "MyObj.h" #include #include using std::cin; using std::cout; using std::endl; void cont(); int main() { int i; tlist lst; MyObj* arr[5]; for (i=0; i<5; i++) { arr[i] = new MyObj((i+1)<<1); lst.add(arr[i]); } // display list lst.print(); cout << "Length: " << lst.length() << "\n\n"; // remove second item and redisplay lst.remove(arr[1]); lst.print(); cout << "Length: " << lst.length() << "\n\n"; cont(); return 0; } void cont() { if (cin.rdbuf()->sungetc() != -1 && cin.get() != '\n') cin.ignore(80,'\n'); cout << "Press enter to continue..."; cin.get(); } /* Sample run: 2 4 6 8 10 Length: 5 2 6 8 10 Length: 4 */