// File: main2.C // // Testing the GenList template with strings #include #include #include #include #include "bstring4.h" #include "genlist3.h" void upcase(BString& bs) { for (int i = 0 ; i < bs.length() ; i++) { bs[i] = toupper(bs[i]) ; } } main() { GenList L ; L.append("Space,") ; L.append("the") ; L.append("final") ; L.append("frontier.") ; L.append("These") ; L.append("are") ; L.append("the") ; L.append("voyages") ; L.append("of") ; L.append("the") ; L.append("Starship") ; L.append("Enterprise.") ; L.print() ; cout << endl ; cout << "length = " << L.length() << endl ; cout << endl ; Iterator it(L) ; BString str ; while ( it.next(str) ) { upcase(str) ; it.set(str) ; } L.print() ; cout << endl ; cout << "length = " << L.length() << endl ; cout << endl ; }