cout << “fail to open file ” << infile << endl;
else {
out_stream.open(outfile.c_str());
list <string> wordlist;
//Remove duplicate words after the list is sorted.
wordlist.unique();
out_stream << “There were ” << wordlist.size()
<< ” distinct words. \n”;
out_stream << “\nHere is the ordered list of words preceded by ” <<
“their counts\n”;
display_list(out_stream,wordlist,wordCount);
wordlist.insert(iter, word);
}
/*———————————————————————-*/
/*———————————————————————-*/
/* This function returns the next word from the input stream. */
/* All non-alpha characters are treated as delimiters. */