From c0fbda7318dc5aac258b39b2e58e75b165944bcc Mon Sep 17 00:00:00 2001 From: SHYAM JEE SINGH <56955738+shyamsingh15@users.noreply.github.com> Date: Tue, 26 Oct 2021 00:03:53 +0530 Subject: [PATCH] Add files via upload --- stl priority_queue.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 stl priority_queue.cpp 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<