// File: main1.C // // Testing the GenList and Iterator template classes #include #include #include #include "genlist3.h" main() { GenList L ; int n ; L.append(5) ; L.append(7) ; L.append(5) ; L.prepend(9) ; L.prepend(8) ; L.prepend(5) ; cout << endl ; L.print() ; cout << endl ; L.begin(n) ; cout << "First item: " << n << endl ; L.end(n) ; cout << "Last item: " << n << endl ; L.chop(n) ; cout << "First item removed: " << n << endl ; Iterator it(L) ; while( it.next(n) ) { cout << n << " " ; it.set(n+1) ; // add one to each element } cout << endl ; L.print() ; cout << endl ; }