/* * CS70, Spring 2001 * * Simple test program for dumb containers and their iterators. The * arguments to the program are placed in a container; then the * iterator is used to step through them and print them out. */ #include "dumbcontainer.hh" #include #include int main( int argc, // Argument count char* argv[]) // Argument vector { DumbContainer holder(argc - 1); // Make space to hold arguments /* * Add the arguments to the container. */ for (int argNo = 1; argNo < argc; argNo++) holder.add(argv[argNo]); /* * Now iterate through the container, printing the arguments. Do * it twice to illustrate the two access operators and the two * incrementation operators. */ for (DumbContainerIterator i(holder); i; ++i) cout << i->c_str() << ' '; cout << endl; for (DumbContainerIterator i(holder); i; i++) cout << *i << ' '; cout << endl; /* * The program always succeeds. */ return 0; }