文件名称:yuandaima
介绍说明--下载内容均来自于网络,请自行研究使用
这也是关于基于算术表达式求值的问题,与上题不一样,希望对有需要的人有用。表达式求解问题
设计一个程序实现基于二叉树表示的算术表达式的操作。
1、 需求分析
1. 算术表达式的合法输入数据包括变量(A~Z,a~z)、常量(0-9)和二元运算符(+,-,*,/,^(乘幂))。程序对数据输入格式不作要求,用户需自己保证语法正确,详见用户手册说明。
2. 演示程序以人机对话的方式执行,即在计算机上显示提示信息后,由用户在键盘上输入对应的数据或命令,程序将执行相应的操作并显示下一步信息。
3. 程序执行的命令包括:
1)根据用户输入的前缀表达式自动添加括号并建立其自然书写形式的表达式;
2)提示用户给各变量赋值;
3)建立二叉树,并基于二叉树进行求值运算,显示结果。
4. 测试数据
分别输入0 a -91 +a*bc +*5^x2*8x +++*3^x3*2^x2x6并输出结果。
每当输入一个表达式后,程序提示用户赋值,再对表达式求值。
-It is also based on the arithmetic expression evaluation on the issue, not the same as the previous question, in the hope useful to those in need. Solving the expression problem
Design a program to achieve that arithmetic expressions based on binary tree operations.
1, needs analysis
1. Arithmetic expression valid input data, including the variable (A ~ Z, a ~ z), constant (0-9) and the binary operators (+,-,*,/,^( exponentiation)). Procedures for data input format is not required, the user must ensure that their grammar is correct, see the user manual instructions.
2. Demo program to man-machine dialogue manner, that is, the computer displays a prompt message, by the user on the keyboard corresponding to the input data or command, the program will execute the corresponding action and displays the next message.
3. Program execution commands include:
1) According to user input automatically add the prefix of an expression in parentheses and the establishment of its natural e
设计一个程序实现基于二叉树表示的算术表达式的操作。
1、 需求分析
1. 算术表达式的合法输入数据包括变量(A~Z,a~z)、常量(0-9)和二元运算符(+,-,*,/,^(乘幂))。程序对数据输入格式不作要求,用户需自己保证语法正确,详见用户手册说明。
2. 演示程序以人机对话的方式执行,即在计算机上显示提示信息后,由用户在键盘上输入对应的数据或命令,程序将执行相应的操作并显示下一步信息。
3. 程序执行的命令包括:
1)根据用户输入的前缀表达式自动添加括号并建立其自然书写形式的表达式;
2)提示用户给各变量赋值;
3)建立二叉树,并基于二叉树进行求值运算,显示结果。
4. 测试数据
分别输入0 a -91 +a*bc +*5^x2*8x +++*3^x3*2^x2x6并输出结果。
每当输入一个表达式后,程序提示用户赋值,再对表达式求值。
-It is also based on the arithmetic expression evaluation on the issue, not the same as the previous question, in the hope useful to those in need. Solving the expression problem
Design a program to achieve that arithmetic expressions based on binary tree operations.
1, needs analysis
1. Arithmetic expression valid input data, including the variable (A ~ Z, a ~ z), constant (0-9) and the binary operators (+,-,*,/,^( exponentiation)). Procedures for data input format is not required, the user must ensure that their grammar is correct, see the user manual instructions.
2. Demo program to man-machine dialogue manner, that is, the computer displays a prompt message, by the user on the keyboard corresponding to the input data or command, the program will execute the corresponding action and displays the next message.
3. Program execution commands include:
1) According to user input automatically add the prefix of an expression in parentheses and the establishment of its natural e
(系统自动生成,下载前可以参看下载内容)
下载文件列表
expression.h
expression.c
expression.c