#include <iostream>
using namespace std;
#include <queue>
#define N 5
int main() {
int arr[5] = { 2,4,6,23,5 };
priority_queue<int> que;
for (int i = 0; i < N; i++)
{
que.push(arr[i]);
cout << "現(xiàn)在優(yōu)先級最高的隊列元素: " <<que.top() << endl;
}
cout << "que size: " << que.size() << endl;
for (int i = 0; i < N; i++)
{
cout << "準備出隊" << que.top() << endl;
que.pop();
}
cout << "que size: " << que.size() << endl;
system("pause");
return 0;
}
自動排序優(yōu)先級大小