一,万能比较,控制排序
struct Rule1{
bool operator()(const int &a,const int &b){
return (a%10) < (b%10);
}
};struct Student{
char name[20];
int id;
int score;
};
struct Rule2{
bool operator()(const Student &s1,const Student &s2){
if(s1.score != s2.score) return s1.score > s2.score;
else return (strcmp(s1.name,s2.name)<0);
}
};
386




被折叠的 条评论
为什么被折叠?



