cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Sorting a field in ascending and descend
Sorting a field in ascending and descending order
Oct 7, 2009 at 4:28pm UTC
Jasina
(1)
Hi!
I need to Sort a records of employees by their last name in ascending and descending order. And these records are from employee database.
Oct 7, 2009 at 4:36pm UTC
R0mai
(730)
Great, how much do you pay?
Oct 7, 2009 at 5:14pm UTC
kempofighter
(1183)
Okay, so you'll need to look at the following links. First, you'll want to read up on std::string objects.
http://cplusplus.com/reference/string/string/
Next, you'll want to see an example using the default std::sort which sorts in ascending order.
http://cplusplus.com/reference/algorithm/sort/
Finally, you'll want to see an example using sort with the predicate for sorting in descending order.
http://cplusplus.com/reference/std/functional/greater/
That should get you started. Good luck!
Topic archived. No new replies allowed.