sort

struct node
{
    char str[22];
    int num;
    int score;
}stu[N];

bool cmp(const node &a, const node &b)
{
    if(a.score == b.score)
        return strcmp(a.str, b.str) < 0 ? 1 : 0; //按字典序升序
    else
        return a.score > b.score;
}

sort(stu , stu + N, cmp);

 

posted on 2013-07-08 21:00  wwjyt  阅读(122)  评论(0编辑  收藏  举报