main.cpp
来自「数据结构与程序设计教材源码 数据结构与程序设计教材源码」· C++ 代码 · 共 32 行
CPP
32 行
#include "../../C/UTILITY.H"
#include <string.h>
#include "POLISH.H"
#include "POLISH.CPP"
main()
{
Expression e;
Token t;
Value x = 0;
cout << "Enter an infix (integer and operator) expression.\n"
<< "It will be translated to postfix and evaluated." << endl
<< "Use a symbol $ to terminate input." << endl;
e.read();
cout << "Your input expression is: ";
e.dump();
Expression f = e.infix_to_postfix();
cout << "Its postfix form is: ";
f.dump();
if (f.evaluate_postfix(x) == fail) cout << "FAIL!\n";
cout << "With value: " << x << endl;
while (true) {
f.get_token(t);
if (t.kind() == end_expression) break;
else cout << t.value << endl;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?