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

ps怎么做网站导航什么网站做产品销售做的好

ps怎么做网站导航,什么网站做产品销售做的好,企业网址搭建,互联网做网站怎么赚钱一个笔试题#xff0c;当时竟然没想出来#xff0c;现在实现下 1 /*2 用两个栈实现双端队列3 栈s1#xff0c;s2。4 pushback()和popback(),必须在s2为空的情况#xff0c;把s2的都放s1中5 pushfront()和popfront(),必须是在s1为空#xff0c;把s1的都给放到s2中6 */7 #in…一个笔试题当时竟然没想出来现在实现下 1 /*2 用两个栈实现双端队列3 栈s1s2。4 pushback()和popback(),必须在s2为空的情况把s2的都放s1中5 pushfront()和popfront(),必须是在s1为空把s1的都给放到s2中6 */7 #include iostream8 #include stack9 using namespace std;10 template typename T11 class DequeBy2Stack12 {13 private:14 int maxsize;15 stackT s1;16 stackT s2;17 public:18 DequeBy2Stack(int size):maxsize(size){}19 void pushback(T n);20 T popback();21 void pushfront(T n);22 T popfront();23 int size();24 bool empty();25 };26 template typename T27 bool DequeBy2StackT::empty()28 {29 return s2.empty()s1.empty();30 }31 template typename T32 int DequeBy2StackT::size()33 {34 return s1.size()s2.size();35 }36 template typename T37 void DequeBy2StackT::pushback(T n)38 {39 if(this-size()maxsize)40 {41 throw new std::exception(Invalid push);42 }43 while(!s2.empty()) //必须将s2中的数据都导入到s1中44 {45 int tmps2.top();46 s1.push(tmp);47 s2.pop();48 }49 s1.push(n);50 }51 template typename T52 T DequeBy2StackT::popback()53 {54 while(!s2.empty())55 {56 int tmps2.top();57 s1.push(tmp);58 s2.pop();59 }60 if(!s1.empty())61 {62 int tmps1.top();63 s1.pop();64 return tmp;65 }66 else67 {68 throw new exception(Invalid popback());69 }70 }71 template typename T72 void DequeBy2StackT::pushfront(T n)73 {74 if(this-size()maxsize)75 {76 throw new std::exception(Invalid push);77 }78 while(!s1.empty())79 {80 int tmps1.top();81 s2.push(tmp);82 s1.pop();83 }84 s2.push(n);85 }86 template typename T87 T DequeBy2StackT::popfront()88 {89 while(!s1.empty())90 {91 int tmps1.top();92 s2.push(tmp);93 s1.pop();94 }95 if(!s2.empty())96 {97 int tmps2.top();98 s2.pop();99 return tmp; 100 } 101 else 102 { 103 throw new exception(Invalid popfront); 104 } 105 } 106 107 int main() 108 { 109 DequeBy2Stackint test(8); 110 int n; 111 for(int i1;i8;i) 112 { 113 test.pushback(i); 114 } 115 test.popback(); 116 test.popfront(); 117 test.popfront(); 118 test.popfront(); 119 test.pushfront(100); 120 test.pushfront(101); 121 test.pushback(30); 122 test.pushfront(102); 123 test.popfront(); 124 while(!test.empty()) 125 couttest.popback()endl; 126 system(pause); 127 } 128  转载于:https://www.cnblogs.com/zmlctt/p/3985128.html
http://www.pierceye.com/news/26061/

相关文章:

  • 中国建设银行官网站电话号码低价网站建设联系方式
  • 做网站用什么网名好个人博客网站模板wordpress
  • 官方网站建设合同做网站的价位
  • 合肥网站建设培训机构正规的外包加工订单网有哪些
  • 沈阳做网站费用wordpress建图片网站
  • 网站的总体结构河北建设厅网站首页
  • 好用的外贸网站免费咨询刑事辩护在线律师
  • 做包装设计的网站有哪些会展相关网站建设
  • solaris.wordpress南宁网站排名优化公司
  • 怎么建设电子商城网站注册公司需要什么证件和手续
  • 网站建设分为几种徐州制作网站软件
  • 苏州高端网站制作官网网站管理建设工作
  • 管理外贸网站模板wordpress发文器
  • 长沙网站建设定制装饰装修材料
  • 百度怎样建立网站企业网站模板html
  • 筑云电商网站建设公司自己制作头像的网站 设计 动漫
  • 用ps做个人网站界面网站留言板html代码
  • 广州网站案例展示网页制作与设计实验报告总结
  • 广州制作网站公司wordpress 克隆页面
  • 的网站建设公司那个好服务器价格购买价格表
  • 酒店要做关于网站ppt怎么做长寿网站制作
  • 网站建设合同用贴印花税吗电商网站建设与运行
  • 黄岐网站建设wordpress 放弃
  • seo网站快速排名站长统计幸福宝宝官方
  • 如何快速建一个网站邢台装修网站建设
  • 华大 建设网站国外域名注册查询
  • 龙岩 网站建设婚恋网站 没法做
  • 网站开发有关书籍市场营销方案怎么写
  • 简述网站建设基本过程seo修改器
  • 一 网站建设管理基本情况网站空间商推荐