<strong>#include<stdio.h>
#include<stdlib.h>
#define LIST_INIT_SIZE 100
#define LISTINCREMENT 10
#define STACK_INIT_SIZE 100
#define STACKINCREMENT 10
typedef char Elemtype;
typedef struct{
Elemtype *elem;
int length;
int listsize;
}SqList;
typedef char TElemtype;
typedef struct BiTNode{
TElemtype data;
struct BiTNode *lchild,*rchild;
}BiTNode,*BiTree;
typedef char SElemtype;
typedef struct{
SElemtype *base;
SElemtype *top;
int stacksize;
}SqStack;
#include"operation.h"
main()
{
SqList L;BiTree T;
InitBiTree(T);
InitList(L);
printf("请输入要操作的算术表达式:");
while((L.elem[L.length]=getchar())!='\n')
{
if(L.length+1>=L.listsize)
{
L.elem=(Elemtype *)realloc(L.elem,
(L.listsize+LISTINCREMENT)*sizeof(Elemtype));
if(!L.elem)exit(-2);
L.listsize+=LISTINCREMENT;
}
L.
利用二叉树求解表达式的值
最新推荐文章于 2023-10-29 11:52:18 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)