Mari Carmen نشر 5 نوفمبر 2020 أرسل تقرير مشاركة نشر 5 نوفمبر 2020 اقتباس رابط هذا التعليق شارك على الشبكات الإجتماعية More sharing options...
0 كريم أمعطيل نشر 15 نوفمبر 2020 أرسل تقرير مشاركة نشر 15 نوفمبر 2020 سأعطيك إجابة عن التمرين بإعتماد الدوال التي طلبوها منك STL::STL (string S, string language) { s = S; lang = language; } string STL::gets () {return s;}//returns the string of the word. STL * STL::getlang () {return lang;}//returns the lang. void STL::print() {cout << s << endl;} void LLN::AddFront (string S) { //Adds a word (If one does't already exist) into the back of the list. string temp1 = S; string temp2 = this->s; int i = 0; while(temp2[i]) { temp2[i] = tolower(temp2[i]); i++; } i = 0; while(temp1[i]) { temp1[i] = tolower(temp1[i]); i++; } if (temp1 == temp2) return; if (lang==NULL) next = new STL (S,NULL); else lang->addback (S); } void LLN::AddBack (string S) { //Adds a word (If one does't already exist) into the back of the list. string temp1 = S; string temp2 = this->s; int i = 0; while(temp1[i]) { temp1[i] = tolower(temp1[i]); i++; } i = 0; while(temp2[i]) { temp2[i] = tolower(temp2[i]); i++; } if (temp2 == temp1) return; if (lang==NULL) next = new STL (S,NULL); else lang->addback (S); } void STL::AddInOrder (string S) { //Adds a word in alphabetical order. We do a check here to determine whether or not the word we're probing for exists. string tempS = this->gets(); for (int i = 0; i < S.length(); i++) { S[i] = tolower(S[i]); } for (int i = 0; i < tempS.length(); i++) { tempS[i] = tolower(tempS[i]); } if (!lang || S < lang->gets()){ lang = new STL (S,next); } else lang->addinorder (S); } void STL::Sort () { //Sort all the words in the list starting with me in reverse order print (); if (lang != NULL) lang->Sort (); } كملاحظة : خلال كل العملية نقوم بتصغير حروف الـstring بإعتماد مصفوفة tolower اقتباس رابط هذا التعليق شارك على الشبكات الإجتماعية More sharing options...
السؤال
Mari Carmen
رابط هذا التعليق
شارك على الشبكات الإجتماعية
1 جواب على هذا السؤال
Recommended Posts
انضم إلى النقاش
يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.