当前位置: 首页 > news >正文

个人门户网站开发邢台58同城

个人门户网站开发,邢台58同城,河北seo优化_网络建设营销_网站推广服务 - 河北邢台seo,超市会员管理系统功能要求#xff1a; 用户可以调用push方法将cat类或dog类的实例放入队列中;用户可以调用pollAll方法#xff0c;将队列中所有的实例按照进队列的先后顺序依次弹出;用户可以调用pollDog方法#xff0c;将队列中dog类的实例按照进队列的先后顺序依次弹出;用户可以调用pollCat… 功能要求 用户可以调用push方法将cat类或dog类的实例放入队列中;用户可以调用pollAll方法将队列中所有的实例按照进队列的先后顺序依次弹出;用户可以调用pollDog方法将队列中dog类的实例按照进队列的先后顺序依次弹出;用户可以调用pollCat方法,将队列中cat类的实例按照进队列的先后顺序依次弹出;用户可以调用isEmpty方法检查队列中是否还有dog或cat的实例;用户可以调用isDogEmpty方法检查队列中是否有dog类的实例;用户可以调用isCatEmpty方法检查队列中是否有cat类的实例。  Pet.h #ifndef _PET_H #define _PET_H #include string using namespace std;class Pet{ private:string type;public:Pet(){}Pet(string type){this-type type;}string getPetType(){return type;} };class Dog :public Pet{ public:Dog() :Pet(dog) {} };class Cat :public Pet{ public:Cat() :Pet(cat) {} };#endif PetEnterQueue.h #ifndef _PETENTERQUEUE_H #define _PETENTERQUEUE_H #include Pet.h using namespace std;class PetEnterQueue { private:Pet pet;long count; public:PetEnterQueue(Pet pet, long count) {this-pet pet;this-count count;}Pet getPet() {return this-pet;}long getCount() {return this-count;}string getEnterPetType() {return this-pet.getPetType();} }; #endif CatDogQueue.h #ifndef _CATDOGQUEUE_H #define _CATDOGQUEUE_H #includePetEnterQueue.h #includePet.h #includeiostream #includequeue using namespace std;class CatDogQueue { private:queuePetEnterQueue dogQ;queuePetEnterQueue catQ;long count;public:void push(Pet pet){if (pet.getPetType() dog) {this-dogQ.push(PetEnterQueue(pet, count));}else if(pet.getPetType()cat){this-catQ.push(PetEnterQueue(pet, count));}}Pet popAll() {if (!catQ.empty() !dogQ.empty()){if (dogQ.front().getCount() catQ.front().getCount()){Pet tmp dogQ.front().getPet();dogQ.pop();return tmp;}else{Pet tmp catQ.front().getPet();catQ.pop();return tmp;}}else if (!catQ.empty()){Pet tmp catQ.front().getPet();catQ.pop();return tmp;}else if (!dogQ.empty()){Pet tmp dogQ.front().getPet();dogQ.pop();return tmp;}else{throw runtime_error(Error empty queue.);}}Dog popDog(){if (!dogQ.empty()){Pet tmpP dogQ.front().getPet();Dog tmpD;Pet* pd tmpD;*pd tmpP;dogQ.pop();return tmpD;}else{throw runtime_error(Error empty dog queue.);}}Cat popCat(){if (!catQ.empty()){Pet tmpP catQ.front().getPet();Cat tmpC;Pet* pc tmpC;*pc tmpP;catQ.pop();return tmpC;}else{throw runtime_error(Error empty cat queue.);}}bool isEmpty(){return dogQ.empty() catQ.empty();}bool isDogEmpty(){return dogQ.empty();}bool isCatEmpty(){return catQ.empty();} };#endif test.cpp #include iostream #include CatDogQueue.husing namespace std; int main() {CatDogQueue test;if (test.isEmpty())cout All queue is empty! endl;test.push(Dog());if (!test.isEmpty())cout All queue is not empty! endl;if (!test.isDogEmpty())cout Dog queue is not empty! endl;if (test.isCatEmpty())cout Cat queue is Empty! endl;for (int i 0; i 2; i){test.push(Cat());test.push(Dog());}cout popAll: test.popAll().getPetType() endl;cout popDog: test.popDog().getPetType() endl;cout popCat: test.popCat().getPetType() endl;cout popAll: test.popAll().getPetType() endl;cout popAll: test.popAll().getPetType() endl;if (test.isEmpty())cout All queue is empty! endl;return 0;   转载于:https://www.cnblogs.com/MuZiShiYe/p/11255490.html
http://www.zqtcl.cn/news/191225/

相关文章:

  • 网站建设 今网科技电商网站建设布局
  • 最优惠的网站优化管理培训机构
  • p2p网站建设广州深圳网站设计公司哪家好
  • 福州网站设计哪里好泰安网站建设入门推荐
  • 北京网站软件制作外卖网站开发
  • 个人网站建设与实现建立个公司网站
  • 南昌招商网站建设临沂兰山建设局网站
  • 母婴网站建设怎么样可以做网站
  • 二手车 网站开发wordpress 定时 检查
  • 淮南官网济南seo优化外包
  • 沈阳网站建设莫道网络网站建设常用六大布局
  • 网站建设外文版要求网站关键字优化销售
  • 马来西亚做公路投标网站设计网页多少钱
  • 织梦网站多少钱广告多的网站
  • 济南网站建站模板深圳南园网站建设
  • 国家免费技能培训官网白杨seo博客
  • 福州seo网站建设微服务网站
  • 网站宽度 像素长沙电商运营培训
  • 备案上个人网站和企业网站的区别app开发多少钱一个
  • 有限公司网站建设 中企动力佛山培训机构招生方案
  • 扫黄打非网站建设专业的高端网站制作公司
  • 做自媒体发视频用哪些网站江西网站建设哪家好
  • wordpress用户列表南宁百度seo排名优化
  • 做网站时如何写接口文档上海网站设计建设公司
  • 网站小图标怎么制作平面设计素材网站推荐
  • 多元网络兰州网站建设惠州网页建站模板
  • 网站建设中首页模板下载网页制作模板保存
  • 宁夏做网站的江苏网站建设的案例展示
  • 网站功能需求文档如何免费域名注册
  • 推广网站的软件包头移动的网站建设