正在加载图片...
s1.push(a’);s2.push(x’); s1. push(b); s2. push(y') sl push(c); s2. push(z') for(i=0; 1<3; i++)cout<<"pop s1: <<sl pop(<<endl for(i=0; 1<3; i++) cout<< pop s2: <<s2. pop(<<endl //定义整型堆栈 stack<int>is1,is2;//创建两个模板参数为int型的对象 isl inito; is2 inito isl. push (1); is2. push (2) is1. push (3); is2 push (4) isl. push (5); is2. push (6) for(i=0;i<3;i++) cout< pop is1: <<isl. pop(<endl for(i=0;i<3;i++ cout< pop is2: <<is2 pop(<<endl return 0s1.push('a'); s2.push('x'); s1.push('b'); s2.push('y'); s1.push('c'); s2.push('z'); for(i=0;i<3;i++) cout<<"pop s1: "<<s1.pop()<<endl; for(i=0;i<3;i++) cout<<"pop s2: "<<s2.pop()<<endl; //定义整型堆栈 stack <int> is1,is2; //创建两个模板参数为int型的对象 is1.init(); is2.init(); is1.push(1); is2.push(2); is1.push(3); is2.push(4); is1.push(5); is2.push(6); for (i=0;i<3;i++) cout<<"pop is1: "<<is1.pop()<<endl; for (i=0;i<3;i++) cout<<"pop is2: "<<is2.pop()<<endl; return 0; }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有