//myListsort.cpp #include #include #include using namespace std; //list sort function int main() { string str1[] = {"A", "C", "B","D"}; string str2[] = {"Apple", "Cherry","Drupe","Banana"}; // list Lstr1(str1, str1+4); list Lstr2(str2, str2+4); // cout<<"\n Lstr1.size() : " << Lstr1.size() <:: iterator it; cout<<"\n before sort ------ "; cout<<"\n Lstr1 ---> "; for(it= Lstr1.begin(); it !=Lstr1.end(); it++) { cout <<" "<< *it; } cout<<"\n Lstr2 ---> "; for(it= Lstr2.begin(); it !=Lstr2.end(); it++) { cout <<" "<< *it; } Lstr1.sort(); Lstr2.sort(); cout<<"\n after sort--------- "; cout<<"\n Lstr1 ---> "; for(it= Lstr1.begin(); it !=Lstr1.end(); it++) { cout <<" "<< *it; } cout<<"\n Lstr2 ---> ";; for(it= Lstr2.begin(); it !=Lstr2.end(); it++) { cout <<" "<< *it; } return 0; }