皮皮学,免费搜题
登录
logo - 刷刷题
搜题
【简答题】
以下程序实现栈的入栈和出栈的操作。其中有两个类:一个是节点类node,它包含点值和指向上一个节点的指针 prev;另一个类是栈类 stack, 它包含栈的头指针 top。 生成的链式栈如下图所示。 〈IMG nClick=over(this) title=放大 src='tp/jsj/2jc++j28.1.gif'〉 下面是实现程序,请填空完成此程序。 include 〈iostream〉 using namespace std; class stack; class node { int data; node *prev; public: node(int d, node *n) { data=d; prev=n; } friend class stack; }; class stack { node *top; //栈头 public: stack() { top=0; } void push(int i) { node *n=【 】; top=n; } int pop() { node *t=top; if (top) { top=top-〉prev; int c= t-〉data; delete t; return c; } return 0; } int main () { stack s; s.push(6); s.push(3); s.push (1); return 0; }
手机使用
分享
复制链接
新浪微博
分享QQ
微信扫一扫
微信内点击右上角“…”即可分享
反馈
参考答案:
举一反三
【多选题】肝外胆道包括
A.
胆囊
B.
肝左管和肝右管
C.
肝总管
D.
胆总管
【多选题】肝外胆道包括
A.
肝左管
B.
肝右管
C.
胆囊管
D.
胆总管
E.
肝总管
【单选题】下列哪种光存储设备的单片单面存储容量最大?( )
A.
VCD
B.
DVD
C.
HD-DVD
D.
Blu-ray Disc
【简答题】A few years ago, Paul Gerner began to gather a group of architects in Las Vegas to ask them what it would take to design a public school that used 50 percent less energy, cost much less to build and o...
【单选题】What does the word 'them' (in Paragraph . . how readers might use them) refer to?
A.
Shampoo.
B.
Artichokes.
C.
Publications.
D.
Readers.
【多选题】肝外胆道包括
A.
B.
胆囊
C.
肝总管
D.
胰管
E.
胆总管
【多选题】肝外胆道包括
A.
胆囊
B.
肝左管和肝右管
C.
胰管
D.
肝总管
E.
胆总管
【判断题】战国古玺的特点是边栏很宽,印文很粗,带有装饰性。()
A.
正确
B.
错误
【单选题】What does 'them' refer to in the sentence 'It sent them streaming westward into the wilderness after their predecessors to raise still more children who wanted still more land'?
A.
Dollars and cents.
B.
Urban dwellers.
C.
Predecessors.
D.
Yearners.
【单选题】What does "giving them cues" mean?
A.
giving them rhythm
B.
telling them when to do what
C.
telling them to stop
D.
telling them to get off stage
相关题目:
参考解析:
知识点:
题目纠错 0
发布
创建自己的小题库 - 刷刷题