// File: main2.C
//
// Testing the GenList template with strings

#include <iostream.h>
#include <iomanip.h>
#include <stdlib.h>
#include <ctype.h>
#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<BString> 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<BString> it(L) ;
   BString str ;
   while ( it.next(str) ) {
      upcase(str) ;
      it.set(str) ;
   }

   L.print() ;
   cout << endl ;
   cout << "length = " << L.length() << endl ;
   cout << endl ;
}
