#include #include using namespace std; class Sentence { public: Sentence(); // default constructor Sentence(string & source); // construct using a string Sentence(istream & strm); // construct using input from a stream // inspectors int HowManyWords(); // how many words in the sentence double AveWordLen(); // ave word length in sentence int LongestWordLen(); // length of longest word in sentence string LongestWord(); // report what the longest word is string GetString() { // report what the sentence is (inline) return sent; } // mutators bool InsertBeforeFirst(string & toFind, string & toInsert); // stick toInsert string immediately before first occurrence of toFind string bool InsertAfterFirst(string & toFind, string & toInsert); // stick toInsert string immediately after first occurrence of toFind string bool InsertBeforeAll(string & toFind, string & toInsert); // stick toInsert string immediately before all occurrence of toFind string bool InsertAfterAll(string & toFind, string & toInsert); // stick toInsert string immediately after all occurrence of toFind string bool RemoveAll(string & toFind); // remove all occurences of toFind string bool RemoveFirst(string & toFind); // remove first occurence of toFind string bool RemoveAllChars (string & toFind); // remove all occurrences of any char in the toFind string private: // private functions int CountBetween (const string & separators); // count how many substrings there are - given a set of possible separators int split (const string & separators, string words[]); // create an array of strings containing the words in the sentence string // data members string sent; }; // allows outputting all info about sentence ostream& operator << (ostream & strOut, Sentence & mySent);