//-------------------------------------------------------------------- // // Driver program for Project 3. // //-------------------------------------------------------------------- #include #include #include "wordcount.h" #include "textanalyst.h" //-------------------------------------------------------------------- void main() { // PRINT HEADER cout << "Play " << " # of" << " Avg" << " Shortest" << " Most" << " Times" << " Long" << " Starts" << endl; cout << "Title " << " words" << " length" << " word" << " common" << " occurs" << " word?" << " w/q,x,z?" << endl; cout << "---------" << "---------" << "---------" << "---------" << "---------" << "---------" << "---------" << "--------- " << endl; // PROCESS Much Ado About Nothing TextAnalyst bill( "ado.txt" ); cout << "Much Ado " << setw(9) << bill.number_of_words() << setw(9) << bill.average_word_length() << setw(9) << bill.shortest_word() << setw(9) << bill.most_common_word() << setw(9) << bill.occurrences_of_most_common() << ( bill.super_long_word_occurs() ? " yes" : " no" ) << ( bill.qxz_word_occurs() ? " yes" : " no" ) << endl; Stradt longest_ado = bill.longest_word(); // PROCESS Much Ado About Nothing bill.read( "hamlet.txt" ); cout << "Hamlet " << setw(9) << bill.number_of_words() << setw(9) << bill.average_word_length() << setw(9) << bill.shortest_word() << setw(9) << bill.most_common_word() << setw(9) << bill.occurrences_of_most_common() << ( bill.super_long_word_occurs() ? " yes" : " no" ) << ( bill.qxz_word_occurs() ? " yes" : " no" ) << endl; Stradt longest_hamlet = bill.longest_word(); // PRINT LONGEST WORDS cout << endl << endl << "Longest word in 'Much Ado': " << longest_ado << endl << "Longest word in 'Hamlet' : " << longest_hamlet << endl; }