#include <vector> #include <iostream> #include <algorithm> using namespace std; struct player { int score; string name; }; player *findHighest(vector<player> &list) { if (list.size() <= 0) return NULL; player *ss = &list[0]; for (int i = 0; i < list.size(); i++) { if (ss->score < list[i].score) { ss = &list[i]; } } return ss; }; int _tmain(int argc, _TCHAR *argv[]) { vector<player> tt; player ss; ss.score = 11; player dd; dd.score = 2; player cc; cc.score = -1; tt.push_back(ss); tt.push_back(dd); tt.push_back(cc); findHighest(tt); return 0; }