数据结构中的表达式求值 2
//把字符转换为相应的整数的函数
int Cint(char mychar){
return (mychar-48);
}
//数字进栈的函数
status PushNum(NumStack &numstack,double num){
if(numstack.top<N)
{numstack.top++;
numstack.array[numstack.top-1]=num; return OK;
}
else return ERROR;
}
//数字出栈的函数
status PopNum(NumStack &numstack,double &num){
if(numstack.top>0){
num=numstack.array[numstack.top-1];
numstack.top--;
return OK;
}
else return ERROR;
}