#include <stdio.h>
#include<direct.h>
#include <io.h>
#include <string>
#include <stdlib.h>
#include <stdarg.h>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
typedef struct
{
int c;
wstring s;
}__term_s;
bool comp(__term_s const& v1,__term_s const& v2)
{
bool ret=false;
if(v1.c>v2.c)
{
ret= true;
}
else if(v1.c<v2.c)
{
ret= false;
}
//if(0<strcmp(v1.s.c_str(),v2.s.c_str()))
//{
// ret = true;
//}
//else
//{
// ret=false;
//}
return !ret;
}
bool comp1(__term_s& v1,__term_s& v2)
{
bool ret=false;
if(v1.c>v2.c)
{
ret= true;
}
else if(v1.c<v2.c)
{
ret= false;
}
//if(0<strcmp(v1.s.c_str(),v2.s.c_str()))
//{
// ret = true;
//}
//else
//{
// ret=false;
//}
return ret;
}
int main( void )
{
vector<__term_s> v;
for(int i=10;i>0;i--)
{
__term_s s;
s.c=i;
s.s=L"linianfu";
v.push_back(s);
}
std::sort(v.begin(),v.end(),comp);
vector<__term_s>::iterator it;
for(it=v.begin();it!=v.end();it++)
{
printf("%ls %d\n",it->s.c_str(),it->c);
}
std::sort(v.begin(),v.end(),comp1);
for(it=v.begin();it!=v.end();it++)
{
printf("%ls %d\n",it->s.c_str(),it->c);
}
getchar();
}