// File: main1.C // // Testing the GenList template class #include #include #include #include "genlist2.h" main() { GenList L ; int length, n ; L.append(5) ; L.append(5) ; L.append(2) ; L.append(7) ; L.append(5) ; L.append(5) ; L.append(13) ; L.append(12) ; L.append(11) ; L.print() ; cout << endl ; length = L.length() ; cout << "length = " << length << endl ; cout << endl ; L.remove(5) ; L.print() ; cout << "\n" << endl ; L.append(17) ; L.append(21) ; L.print() ; cout << "\n" << endl ; n = L.chop() ; cout << "Removed item: " << n << endl ; L.print() ; cout << "\n" << endl ; n = L.begin() ; cout << "First item: " << n << endl ; L.print() ; cout << endl ; cout << "Save this list\n" << endl ; GenList *Gptr = new GenList(L) ; L.chop() ; L.chop() ; L.chop() ; L.chop() ; L.chop() ; L.print() ; cout << endl ; L.chop() ; L.print() ; cout << endl ; L.append(1) ; L.append(2) ; L.append(3) ; L.print() ; cout << "\n" << endl ; cout << "\nSaved list:" << endl ; Gptr->print() ; cout << "\n" << endl ; }