C++类对象数组按某一属性排序问题,急求大神帮助啊!

class Student{
public:
string x;
};

我怎么按由大到小的顺序排序啊?
sort没用的说,求大神详细代码!

 #include<iostream>
#include<algorithm>
using namespace std;
class Student{
public:
string x;
};
short comp(const Student &a,const Student &b)
{
    return a.x>b.x;
}
int main()
{
    Student a[5];
    int i;
    for(i=0;i<5;i++)
        cin>>a[i].x;
    sort(a+0,a+5,comp);
    for(i=0;i<5;i++)
        cout<<a[i].x<<" ";
    cout<<endl;
}

你要给你的Student类重载小于运算符,sort才有用啊,因为sort要有比较才能实现排序功能。

bool operator<(const Student &a) const{
return x < a.x;
}

http://ideone.com/dGRWTN

输入
luie
david
mary
green
albert
输出
mary luie green david albert