nsoleapplication14cpp:
cde“stdafxh“
cdeiostrea
cdefstrea
cdestrg
cdestdlibh
cdeioanip
cdedowsh
cdeath
naspace std
defe aize 0xffff
= 0
n = 0
n = 0stack nuber
bool fg=1
= 0变量存储
struct node {
node dex
node
o=null
node child=null
id
strg text
bool hasval=true
double val
}s, a, b, c, d, e, f, g, h, i, j,sheet,p,start
struct variable{
strg na
double val
}var[20]
fd_var(strg a){
fori = 0 i i)
(var[i]na == a)
retu i
retu -1
}
teptecss type
css y_stack
{
type y_s
aize
public:
y_stack:(-1), aize(aize)
{
y_s = new type[aize]
(y_s == null)
{
cerr “动态存储分配失败!“ endl
exit(1)
}
}
y_stack(t size):(-1), aize(size)
{
y_s = new type[aize]
(y_s == null)
{
cerr “动态存储分配失败!“ endl
exit(1)
}
}
~y_stack
{
delete y_s
}
是否为空
bool epty
压栈
node ph(type tp)
返回栈顶元素
type
返回第n个栈顶元素
typen)
出栈
void pop
栈大小
size
strg show
strg show
nu
}
teptecss type
bool y_stacktype::epty
{
( ==-1){
retu true
}
else
retu false
『加入书签,方便阅读』