Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
PriQHotel2
//g++ 7.4.0 /////////////////////////////////////////////////////////////////////// //PriQHotel2: //this code is created by Rezaul Hoque on August 10,2022; //contact:jewelmrh@yahoo.com;Dhaka,Bangladesh;https://rezaulhoque.wordpress.com,https://hoquestake.blogspot.com //note: codes shared by Rezaul Hoque on rextester are not for sale; they are created and shared to facilitate the algorithm learning process; many like Hoque use this platform to practice programming ;Rezaul hopes his contribution helps others to fine tune their learning; ////////////////////////////////////////////////////////////////////////////// #include <iostream> #include <queue> #include <map> #include <string> using namespace std; class Hotel{ std::string name; map<std::string, int> m; public: Hotel(std::string n, map<std::string, int> f); std::string getN() const; map<std::string, int> getM(); }; map<std::string,int> Hotel::getM(){ return this->m; } Hotel::Hotel(std::string s,map<std::string, int> k) { this->name=s; this->m=k; } std::string Hotel::getN() const { return this->name; } int main() { Hotel a("XYZ",{{"****",2500}}); Hotel b("ABC",{{"***",100}}); Hotel c("WWS",{{"**",500}}); priority_queue<map<std::string,int>,vector<map<std::string, int>>,less<map<std::string,int>>> QS; QS.push(a.getM()); QS.push(b.getM()); QS.push(c.getM()); while (!QS.empty()){ map<std::string, int> h=QS.top(); for (auto p:h){ std::cout<<p.first<<" "<<p.second<<" \n"; } QS.pop(); } return 0; }
run
|
edit
|
history
|
help
0
¡Arriba, Papalotes, Arriba!
LRUCache
remove_copy_if-30-Seconds-of-C++
Reverse a String
single_digit
Pierwiastkowanie
3
ProdPriceEnum
cppPyDicCom
ammmma