Code /* testgll.cpp CIS 250 David Klick 2016-03-22 Test driver for templated linked list class (gll.h). */ #include "gll.h" #include "MyObj.h" #include #include using std::cin; using std::cout; void cont(); int main(int argc, char* argv[]) { int i; gll lst; MyObj arr[5]; for (i=0; i<5; i++) { arr[i].setNum((i+1)<<1); lst.add(arr[i]); } // display list cout << lst << "\nLength: " << lst.length() << "\n\n"; // remove second item and redisplay cout << "Removing second element from list (" << arr[1] << ")\n"; lst.remove(arr[1]); cout << lst << "\nLength: " << lst.length() << "\n\n"; // remove last item and redisplay cout << "Removing last element from list (" << lst.removeLast() << ")\n"; cout << lst << "\nLength: " << lst.length() << "\n\n"; return 0; } /* Sample run: 2 4 6 8 10 Length: 5 Removing second element from list (4) 2 6 8 10 Length: 4 Removing last element from list (10) 2 6 8 Length: 3 */