polish.h
来自「数据结构与程序设计教材源码 数据结构与程序设计教材源码」· C头文件 代码 · 共 35 行
H
35 行
typedef int Value;
enum Token_type {operand, unaryop, binaryop, end_expression, leftparen, rightparen, rightunaryop};
struct Token {
Token_type kind();
int priority();
char value[20];
};
class Expression {
public:
Error_code evaluate_prefix(Value &result);
Error_code evaluate_postfix(Value &result);
Error_code recursive_evaluate(Value &result, Token &final);
Error_code get_token(Token &result);
Expression infix_to_postfix();
void put_token(Token &result);
void put_token(char *);
void read();
void dump() { cout << value << endl; }
Expression() { value[0] = '\0'; start = 0; count = 0; }
void clear() { value[0] = '\0'; start = count = 0; }
~Expression() { clear(); }
private: // data to store an expression
char value[10000];
int start, count;
};
typedef Token Node_entry;
#include "../../4/NODES/NODE.H"
typedef Token Stack_entry;
#include "../../4/LINKSTAC/STACK.H"
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?