#include <queue>
#include <iostream>
#include <vector>
#include <time.h>
using namespace std;
void main(void)
{
priority_queue<int,vector<int>,greater<int> > que;
priority_queue<float,vector<float>,less<int> > que1;
srand((unsigned) (time)(NULL));
for(int i = 1; i <= 20; i++)
{
int key = rand()%100;
que.push(key);
que1.push(key);
}
while(!que.empty() && !que1.empty())
{
int m = que.top();
float mm = que1.top();
cout<<m<<"\t"<<mm<<endl;
que.pop();
que1.pop();
}
cout<<endl;
}
-----------------
0 88
3 73
5 72
6 71
9 70
10 70
13 66
25 58
29 51
33 44
44 33
51 29
58 25
66 13
70 10
70 9
71 6
72 5
73 3
88 0
Press any key to continue