~cpp #include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; struct student { string name; int score; }; bool compare(student a, student b) { return a.name>b.name; } int main() { student boy1; boy1.name = "a"; boy1.score = 90; student boy2; boy2.name ="b"; boy2.score=80; student boy3; boy3.name="c"; boy3.score=65; student boy4; boy4.name="d"; boy4.score=89; student boy5; boy5.name="e"; boy5.score=23; vector <student> vec; vec.push_back(boy1); vec.push_back(boy2); vec.push_back(boy3); vec.push_back(boy4); vec.push_back(boy5); sort(vec.begin(),vec.end(), compare); vector<student>::iterator i=vec.begin(); for(i=vec.begin();i!=vec.end();i++) { cout<<(*i).score<<endl; }