#include < queue >
#include < iostream >
using namespace std;
struct myComp
{
bool operator()(const int &a, const int &b)
{
return a > b ;
}
};
int main()
{
priority_queue < int , vector < int > , myComp > pq;
pq.push(1);
pq.push(10);
pq.push(9);
pq.push(4);
pq.push(6);
pq.push(7);
cout << pq.size() << endl;
while( pq.empty() != true )
{
cout << pq.top() << " ";
pq.pop();
}
cout << endl;
getchar();
getchar();
return 0;
}
|