int main() { string text = "it was the best of times, it was the worst of times."; list<string> words; string separators = " .,!?:"; split(text, separators, words); string smallest = words.front(); string largest = words.front(); list<string>::iterator current; list<string>::iterator stop = words.end(); for (current = words.begin(); current != stop; ++current) { if (*current < smallest) smallest = *current; if (largest < *current) largest = *current; } cout << "smallest word " << smallest << endl; cout << "largest word " << largest << endl; return 0;

Previous slide Back to first slide View graphic version