假定从键盘上输入一批整数,依次为:78 63 45 30 91 34 –1,请写出输出结果。

# include < iostream.h>
# include < stdlib.h >
consst int stackmaxsize = 30;
typedef int elemtype;
struct stack {
elemtype stack [stackmaxsize];
int top;
};
# include “stack.h”
Void main ( )
{
stack a;
initstack(a);
int x;
cin >>x;
while (x! = -1) {
push (a, x );
cin >>x;
}
while (!stackempty (a))
cout <<pop (a) <<”” ;
cout <<end1;
}
该算法的输出结果为:

点点赞赏,手留余香 给TA打赏

AI创作

评论0

请先
支持多种货币
支持多种货币付款,满足您的付款需求
7天无忧退换
安心无忧购物,售后有保障
专业客服服务
百名资深客服7*24h在线服务
发货超时赔付
交易成功极速发货,专业水准保证时效性

站点公告

开放大学课程作业辅导,有需要扫码加微信

显示验证码

社交账号快速登录

微信扫一扫关注
扫码关注后会自动登录