Question: Task C: Dictionary Admin Operations Languages evolve constantly. Hundreds of new English words are added to the English dictionary each year. Definitions of words change.

Task C: Dictionary Admin Operations

Languages evolve constantly. Hundreds of new English words are added to the English dictionary each year. Definitions of words change. Thus, we should be able to modify, add and remove words in our dictionary. Besides, dont you want to use your own words for hangman? Add and implement the following functions to your .cpp file:

/* @param word : The string with a new word @param definition : The string with the definition of the new `word` @param pos : The string with the pos of the new `word` @return : return `true` if the word is successfully added to the dictionary return `false` if failed (word already exists or dictionary is full) @post : Add the given `word`, `definition`, `pos` to the end of the respective global-arrays. The word should not be added to the global-arrays if it already exists or if the array reached maximum capacity(`g_MAX_WORDS`). Update `g_word_count` if the word is successfully added */ bool addWord(string word, string definition, string pos); /* @param word : The string with the word that is to be edited @param definition : The string with the new definition of the `word` @param pos : The string with the new pos of the `word` @return : return `true` if the word is successfully edited, return `false` if the `word` doesn't exist in the dictionary @post : Replace the given `word`'s definition and pos with the given `definition` and `pos` (by modifying global-arrays `g_definitions` and `g_pos`). The modification will fail if the word doesn't exist in the dictionary */ bool editWord(string word, string definition, string pos); /* @param : The string with the word that is to be removed @return : return `true` if the word is successfully removed from the dictionary return `false` if the word doesn't exist in the dictionary @post : Remove the given `word`, `word`'s definition and `word`'s pos from the respective global-arrays if the word exists. Update `g_word_count` if the word is successfully removed */ bool removeWord(string word); 

Hint: For the removeWord() function, the order of the global-arrays doesnt matter. An empty string array is full of empty strings ()

You can use the functions you wrote previously within the implementation of Task C functions. The getIndex() function is extremely useful!

Test each function before moving on to implement the next one. Submit only one .cpp file without the main() function similar to the previous tasks.

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!