Create a doubly linked list of strings, each string has the following information: string S; // the string itself string language; // the language of the string
Note: Use the STL string (#include “string”) In your main function, create 3 lists, read their information from a text file, and use the lists to test the following functions. The text file has the following format: You need to implement the following functions: 1. AddFront: Takes a word and its language as parameters, and adds the word to the front of the list. 2. AddBack: Takes a word and its language as parameters, and adds the word to the end of the list. 3. AddInOrder: Takes a word and its language as parameters, and adds the word to the list according to the alphabetical order. This function must call the function (Sort) first. 4. Sort: Sorts the words in the list according to the alphabetical order of the words 5. RemoveFront 6. RemoveBack 7. CountLanguage: This function takes a language as a parameter and returns the number of words in the list that are in that language. List1: Hello English merci French table English List2: ……………………………….. List 3: ………………………………. 8. Search: Takes a word as a parameter and returns the number of the node that contains the word if it exists, it returns 0 otherwise. 9. RemoveWord: Takes a word as a parameter, searches for the word and removes it from the list (this function must call the function Search) 10. Equal: in this function you need to overload the (==) operator to test of two lists are equal or not.
السؤال
Mari Carmen
ممكن مساعدتي بحل سؤال
Create a doubly linked list of strings, each string has the following information: string S; // the string itself string language; // the language of the string
Note: Use the STL string (#include “string”) In your main function, create 3 lists, read their information from a text file, and use the lists to test the following functions. The text file has the following format: You need to implement the following functions: 1. AddFront: Takes a word and its language as parameters, and adds the word to the front of the list. 2. AddBack: Takes a word and its language as parameters, and adds the word to the end of the list. 3. AddInOrder: Takes a word and its language as parameters, and adds the word to the list according to the alphabetical order. This function must call the function (Sort) first. 4. Sort: Sorts the words in the list according to the alphabetical order of the words 5. RemoveFront 6. RemoveBack 7. CountLanguage: This function takes a language as a parameter and returns the number of words in the list that are in that language. List1: Hello English merci French table English List2: ……………………………….. List 3: ………………………………. 8. Search: Takes a word as a parameter and returns the number of the node that contains the word if it exists, it returns 0 otherwise. 9. RemoveWord: Takes a word as a parameter, searches for the word and removes it from the list (this function must call the function Search) 10. Equal: in this function you need to overload the (==) operator to test of two lists are equal or not.
تم التعديل في بواسطة omar haddadتعديل العنوان
1 جواب على هذا السؤال
Recommended Posts
انضم إلى النقاش
يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.