📄 infix.cpp
字号:
// generate infix from expression tree
#include <iostream>
#include "binaryTreeNode.h"
using namespace std;
template <class T>
void infix(binaryTreeNode<T> *t)
{// Output infix form of expression.
if (t != NULL)
{
cout << '(';
infix(t->leftChild); // left operand
cout << t->element; // operator
infix(t->rightChild); // right operand
cout << ')';
}
}
int main(void)
{
binaryTreeNode<int> x,y,z;
x.element = 1; y.element = 2; z.element = 3;
x.leftChild = &y; x.rightChild = &z;
y.leftChild = y.rightChild = z.leftChild = z.rightChild = 0;
infix(&x);
cout << endl;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -