diff --git a/stl priority_queue.cpp b/stl priority_queue.cpp new file mode 100644 index 0000000..aead48c --- /dev/null +++ b/stl priority_queue.cpp @@ -0,0 +1,37 @@ +#include +#include + +using namespace std; + + struct process + { + int arr_t,b_t; + }; + struct CompareHeight { + bool operator()(process const& p1, process const& p2) + { + // return "true" if "p1" is ordered + // before "p2", for example: + return p1.arr_t > p2.arr_t; + } + }; + + int main() + { + int a; + priority_queue,CompareHeight> pq; + process p; + cout<<"enter three number::"; + for(int i=0;i<3;i++) + { + cin>>p.arr_t>>p.b_t; + pq.push(p); + } + while(!pq.empty()) + { + p=pq.top(); + cout<