Structure Sorting in C / C++ with bool function

We have a structure and our element's Id and Age.

Now, we need to sort this Data,  

Rules:
If  Id is different, then students with higher Age get better rank.
OtherWise, get higher age.

Example:

Input Elements in our structure:

Id      Age
3       5
2       6
5       7
5       3

Output Elements in our structure:

Id      Age
2       6
3       5
5       3
5       7


Post a Comment

0 Comments