сортировка элементов структуры с++

нужно отсортировать список по определенным (любым из перечисленных, кроме ID) критериям

using namespace std;
struct inf
{
    int ID;
    string name;
    int age;
    int numViolation;
    inf* next;
};
void add(inf* m, int num, string nnme, int a, int b)
{
    inf* tmp = new inf;
    tmp->ID = num;
    tmp->name = nnme;
    tmp->age = a;
    tmp->numViolation = b;
    tmp->next = m;
    m = tmp;
}
void print(inf*& m)
{
    inf* tmp = m;
    while (tmp != NULL)
    {
        cout << tmp->ID << ". " << tmp->name << "  " << tmp->age << "  " << tmp->numViolation << endl;
        tmp = tmp->next;
    }
}
void sort(inf* m)
{

}
void print2(inf*& m)
{
    inf* tmp = m;
    while (tmp != NULL)
    {
        if (tmp->numViolation > 2 && tmp->numViolation < 5) cout << tmp->ID << ". " << tmp->name << "  " << tmp->age << "  " << tmp->numViolation << endl;
        tmp = tmp->next;
    }
}
int main()
{
    return 0;
}```

Ответы (0 шт):