Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
VecHotel
//g++ 7.4.0 ///////////////////////////////////////////////////////////////////////////// //VecHotel //this code is created by Rezaul Hoque on August 15,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 <string> #include <vector> using namespace std; class Hotel{ std::vector<std::string> star; int rent; public: Hotel(std::vector<std::string> s,int r); std::vector<std::string> getS(); int getR() ; }; Hotel::Hotel(std::vector<std::string> s,int r) { this->star=s; this->rent=r; } std::vector<std::string> Hotel::getS() { return this->star; } int Hotel:: getR() { return this->rent; } int main() { std::vector<std::string>s1,s2,s3,s4; s1.push_back("***"); s2.push_back("****"); s3.push_back("**"); s4.push_back("***"); Hotel a(s1,900); Hotel b(s2,3000); Hotel c(s3,2500); Hotel d(s4,1000); priority_queue<std::vector<std::string>,vector<std::vector<std::string>>,greater<std::vector<std::string>>> QS; QS.push(a.getS()); QS.push(b.getS()); QS.push(c.getS()); QS.push(d.getS()); std::cout<<"Hotels listed on stars:\nStars\n"; while (!QS.empty()){ std::vector<std::string> h=QS.top(); QS.pop(); for(auto p:h){ std::cout<<p<<" "<<" \n";} } return 0; }
run
|
edit
|
history
|
help
0
Samosa
Sekhejane link
pac update
Guess Number
WeekAgenda2
LIS
ListTel
133
Find Case Combinations of a String
Peg Grammar AST Parser Computer Language Interpreter