#include "stdafx.h"
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct information
{
int a;
int b;
int c;
int d;
information()
{
a = 0;
b = 1;
c = 2;
d = 3;
}
};
inline bool compareIfo(information x1, information x2)
{
return x1.a > x2.a;
}
int _tmain(int argc, _TCHAR* argv[])
{
vector<information> vecIfo;
information ifo1;
ifo1.a = 0;
ifo1.b = 1;
ifo1.c = 2;
ifo1.d = 3;
vecIfo.push_back(ifo1);
information ifo2;
ifo2.a = 1;
ifo2.b = 1;
ifo2.c = 2;
ifo2.d = 3;
vecIfo.push_back(ifo2);
sort(vecIfo.begin(), vecIfo.end(), compareIfo);
return 0;
}

|