#include <iostream>
#include <queue>
#include <deque>
#include <list>
using namespace std;
void main1()
{
//优先队列
priority_queue<int> myq;
myq.push();
myq.push();
myq.push();
myq.push();
while(!myq.empty())
{
cout << myq.top() << endl;
myq.pop();
}
cin.get();
}
struct getmoney
{
char *com;
int money;
};
struct lessX
{
bool operator()(struct getmoney &m1, struct getmoney &m2)
{
//return m1.money < m2.money;
if (strcmp(m1.com, m2.com) >= )
{
return true;
}
else
{
return false;
}
}
};
void main()
{
//优先队列,采用deque方式容易插入
priority_queue<getmoney, deque<getmoney>,lessX> myq;
getmoney getm[] = { {"Google",},{"baidu",},{"",},{"sina",},{"tecent",} };
for (auto i : getm)
{
myq.push(i);
}
while (!myq.empty())
{
cout << myq.top().com << " " << myq.top().money << endl;
myq.pop();
}
cin.get();
}