填空题:下面是一个栈类的模板,其中push函数将元素i压入栈顶,pop函数弹出栈顶元素。栈初始为空,top值为0,栈顶元素在st

  • 题目分类:C++
  • 题目类型:填空题
  • 查看权限:VIP
题目内容:
下面是一个栈类的模板,其中push函数将元素i压入栈顶,pop函数弹出栈顶元素。栈初始为空,top值为0,栈顶元素在stack[top-1]中,在下面横线处填上适当语句,完成栈类模板的定义。
template
classTstack
{
enum{size=1000};
Tstack[size];
inttop;
public:
Tstack():top(0){}
voidpush(constT&i){
if(top
stack[top++]=i;
}
Tpop(){
if(top==0)exit(1);//栈空时终止运行
return(15);
}
};
参考答案:
答案解析:

Please do not hesitate to call me if I can be of further ass

Please do not hesitate to call me if I can be of further assistance.A.contact B.

查看答案

关于世界气温的分布情况,下列说法正确的是:

关于世界气温的分布情况,下列说法正确的是:A.纬度是决定气温分布的主要因素,所以无论是1月还是7月.气温都从高纬向低纬递减 B.在北半球大陆上,1月份等温线向北

查看答案

The word “affect” in Paragraph 6 could be best replaced by

The word “affect” in Paragraph 6 could be best replaced byA.“influence” B.“effec

查看答案

Flowers and Yeo have started a programme

Flowers and Yeo have started a programmeA.to find ways to prevent water pollutio

查看答案

What does the last sentence in the third paragraph imply?

What does the last sentence in the third paragraph imply?A.More stress should be

查看答案