Question: Please Help:- Write a c++ program:- Process the attached file of words to determine all the 7-letter words that start with qu or ch and

Please Help:- Write a c++ program:- Process the attached file of words to determine all the 7-letter words that start with "qu" or "ch" and have the same last 5 letters, such as "charter" and "quarter". Use the class template below. Fill out the Questions in class & int main() function. class Word { std::string word; // the word bool startqu; // true if the first 2 letters of the word are q and u bool startch; // true if the first two letters of the word are c and h int length; // length of the word Word *next; // a pointer to another instance of Word public: Word(std::string& w); // constructor bool startWithqu() const; // startqu accessor bool startWithch() const; // startch accessor bool prefixEqual(std::string& pfx) const; // is this word's prefix equal to the passed string bool suffixEqual(std::string& sfx) const; // is this word's suffix equal to the passed string Word *getNext() const; // next accessor Word *setNext(Word *n); // next set accessor std::string getWord() const; // word accessor }; Word::Word(std::string& w) { /* constructor */ /* initialize all member variables */ /* set the value of the startch and startqu flags */ } bool Word::startWithch() const { /* startch accessor */ } bool Word::startWithqu() const { /* startqu accessor */ } bool Word::prefixEqual(std::string& pfx) const { /* is this word's prefix equal to the passed string */ } bool Word::suffixEqual(std::string& sfx) const { /* is this word's suffix equal to the passed string */ } Word *Word::getNext() const { /* next accessor */ } Word *Word::setNext(Word *n) { /* next set accessor */ /* return the new value */ } std::string Word::getWord() const { /* word accessor */ } int main() { const int TARGET_LENGTH = 7, START = 2; std::string fileName = "/Users/danevans/Downloads/7ltr-words.txt"; std::ifstream file; std::string word, sfx; std::string sent = "sentinel"; Word *chwords, *quwords, *qusq, *chsq, *obj; int chsiz, qusiz, count; file.open(fileName); if (!file) { cout << "unable to open file: " << fileName << endl; return -1; } /* create sentinel words to start the ch list and the qu list */ /* read and process each word */ while (getline(file, word)) { /* filter out words whose length is not seven letters */ /* construct a Word object from the input word */ /* if the Word instance starts with qu, add it to the qu list */ /* else if the Word instance starts with ch, add it to the ch list */ /* else free the object since it doesn't start with qu or ch */ } /* finish with the file */ /* drop and free the sentinel on each of the lists */ /* loop through the ch list */ while (0 != chsq) { /* get the 5 charactder suffix of the current ch Word */ /* loop through the qu list */ while (0 != qusq) { /* if the qu suffix is equal to the ch suffix, count it and display the words */ } } /* display the results of the searches */ cout << "found " << (chsiz + qusiz) << " seven letter words starting with \"qu\" or \"ch\"" << endl; cout << "found " << count << " matches" << endl; /* free the ch list */ /* free the qu list */ return 0; } 

Below is the text file:-

aarrghh abactor abalone abanded abandon abasers abashed abashes abasias abasing abaters abating abators abattis abature abaxial burleys burlier burlily burling burners burnets burnies burning burnish burnous burnout burping burrell burrels burrers burrhel burrier burring burrito burrows bursars bursary bursate burseed bursera bursted bursten burster burthen cynical cynipid cyphers cypress cyprian cyprids cyprine cypsela cystein cystids cystine cystoid cytases cytisus cytodes cytosol czapkas czardas czardom czarina czarism czarist dabbers dabbing dabbity dabbled dabbler dabbles daboias dabster dacites dackers dacoits dacoity dacrons dactyli dactyls dadaism dadaist daddies dadding daddled daddles daddock dadoing daemons daffier daffies daffily daffing daftars daftest dafties dagabas daggers daggier dagging daggled daggles daglock dagobas dagwood dahlias dahoons daidled daidles daikers daikons dailies daimios daimons daimyos daining dairies dairyer daisied daisies dakered dakoiti dakoits dakoity dalapon dalasis daledhs daleths dallied dallier dallies dallops daltons damaged damager damages damasks dambrod damfool damiana dammars dammers damming damners wurlies wurzels wussier wussies wuthers wuzzled wuzzles wysiwyg wyverns xantham xanthan xanthic xanthin xenopus xerafin yuckers yuckier yucking yukatas yukiest yukkier yukking yummier yummies yumpies

Thank you so much for helping!!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!