问题 填空题

请将下列栈类Stack补充完整。
class Stack
private:
intpList[100]//int数组,用于存放栈的元素
inttop;//栈顶元素(数组下标)
public:
Stack();top(0)
void Push(const int &item);//新元素item压入栈
int Pop(void); //将栈顶元素弹出栈

void Stack::Push(const int&item)
if(top==99) //如果栈满,程序终止
exit(1)
top++;//栈顶指针增1
______;

int Stack::Pop()
if(top(0) 如果栈空,程序终止
exit(1);
return pList[top--];

答案

参考答案:pList[top]=item略。

句型转换
填空题