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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Dec 1, 2014, 1:30 PM
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:
Joe WilsonPosted Dec 1, 2014, 2:43 PM
Shweta LodhaPosted Dec 1, 2014, 11:57 AM
Joe WilsonPosted Nov 30, 2014, 6:57 AM
I want to do that in C++
Shweta LodhaPosted Nov 30, 2014, 1:17 AM