Question: Please write code in C++ for the following functions // This function accepts the dictionary as a parameter as well as a C-string containing //

Please write code in C++ for the following functions

// This function accepts the dictionary as a parameter as well as a C-string containing // the characters of the document. It checks the spelling of all the words that come after // location start in the document C-string. If an incorrectly spelt word is encountered, // it is copied to the C-string errorWord and the function terminates by returning the // starting location of the word that has been spelt incorrectly. If there are no spelling // errors, the function must return -1.

int checkSpelling (string dictionary[], int numWords, char document[], int start, char errorWord[]) { displayText ("Searching for spelling errors ...", "Check Spelling");

return -1; }

// This function is similar to the checkSpelling function. It searches the entire document // C-string for incorrectly spelt words. Whenever an incorrectly spelt word is encountered, // it is inserted in the array of errorWords which was passed as a parameter. The function // returns the amount of words that were incorrectly spelt in the document.

int checkSpellingAll (string dictionary[], int numWords, char document[], string errorWords[]) { displayText ("Searching for spelling errors ...", "Check Spelling");

return 0; }

// This function accepts the document C-string as a parameter, analyses it, and stores // the results of the analysis in a Statistics struct. This struct is then returned to // the caller.

Statistics getStatistics (char document[]) {

Statistics result;

displayText ("Generating statistics ...", "Statistics"); result.wordCount = 0; result.longestWord = 0; result.shortestWord = 0; result.numChars = 0; return result;

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!