[工学]第3章 栈和队列jqj.ppt

[工学]第3章 栈和队列jqj

(2) 后缀表达式求值 从左至右扫描:先找运算符,再找操作数。 循环队列示意图 int isoperator( char op ) // 判断运算符 { switch ( op ) { case +: case - : case *: case / : return 1; // 是运算符 default: return 0; // 不是运算符 } } int getvalue( char op, int operand1, int operand2 ) // 计算表达式值 { switch( op ) { case *: return(operand1*operand2); case /: return(operand1/operand2); case +: return(operand1+operand2); case -: return(operand1-op

文档评论(0)

1亿VIP精品文档

相关文档