// dtest.cpp -- test program for Dictionary class // cse143 assignment 2 sample soltuion. 1/99 hp #include #include #include "dictionary.h" // Read words and add them to Dictionary d until an isolated period // is entered. Then print the words and their frequencies. const int maxStrLen = 250; // length of input buffer void main( ) { Dictionary d; // words from input and their frequencies char word[maxStrLen]; // current input word const char endMark[] = "."; // end-of-input marker (period) cout << "Enter text followed by an isolated period.\n"; cin >> word; while (strcmp(word,endMark) != 0) { d.add(word); cin >> word; } cout << "\nThe input contains " << d.size() << " unique words.\n"; cout << "Input words sorted by frequency, then alphabetically:\n"; cout << d << endl; }