⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 postfixcompute.cpp

📁 postfixComputer, Calculate the postfix expression, such as 45+,which means 4+5,and the result is 9.
💻 CPP
字号:
#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>
#include<maths>

using namespace std;



int PostFixCompute(BTreeNode<T> *root);

{
	if( root == NULL)
	{
		cout<<"Empty!"<<endl;

		return 0;
	}
	else if(root->isLeaf())//判断是否为叶结点

		cout<<root->value<<endl;

		return 1;

	else 
	{
		stack s;

		int temp,a,b;

		while(!root == NULL)
		{
			while(!root->leftchild->isLeaf())//判断左子树结点是否为叶结点
			{
				root = root->leftchild;
			}
			a = root->leftchild->value;

			if (!root->rightchild==NULL)

				b = root->rightchild->value;

				temp =root->value;

				root->value = a temp b;

			else
			







		

		{
			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 + -