📄 expresscompute.cpp
字号:
// ExpressCompute.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "BTree.h"
#include "BTreeNode.h"
#include "InfixToPostfix.h"
#include "PostfixToBTree.h"
#include<iostream>
#include<string>
#include<stack>
#include<cctype>
#include<vector>
using namespace std;
void main()
{
int InfixToPostfix();//将输入的中缀表达式转换成后缀表达式
BTreeNode *PostfixToBTree(vecPostfix[]);//将得到的后缀表达式转换成二叉树
int PostFixCompute(*pointer);//后序遍历该二叉树,计算并输出表达式的值
{
stack<char> s;
string operatorSymbol = "+-*/()";
enum state{OPERAND, OPERATOR};
stack s;
int temp;
do
{
while(!root==NULL)
{
root = root->leftchild;
}
a = root->leftchild->element;
if(!root->rightchild==NULL)
PostOrder(root->leftchild);
PostOrder(root->rightchild);
Visit(root);//后序周游二叉树或其子树
}
temp = root->element;
cout<<temp<<endl;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -