I want to sort few link list according to their data and the data must be sorted according to their ASCII codes . please help me to find out how to do that.
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Dec 1, 2014, 8:30 AM EST
This means that digits will sort before upper case letters which will in turn sort before lower case letters. Here's a quick example:
#include
#include
#include
using namespace std;
int main()
{
list
list
months.push_back("october");
months.push_back("December");
months.push_back("february");
months.push_back("1st month");
months.sort();
cout << "After sorting, the list contains" << endl << endl;
for(it = months.begin(); it != months.end(); it++)
{
cout << *it << endl;
}
cout << endl;
return 0;
}
The output is:
Shweta LodhaRank #31 · 39.8K reputationPosted Nov 29, 2014, 8:17 PM EST
Shweta LodhaRank #31 · 39.8K reputationPosted Dec 1, 2014, 6:57 AM EST
Joe WilsonRank #631 · 3.8K reputationPosted Nov 30, 2014, 1:57 AM EST
I want to do that in C++
Joe WilsonRank #631 · 3.8K reputationPosted Dec 1, 2014, 9:43 AM EST