文件名称:Expreesion
-
所属分类:
- 标签属性:
- 上传时间:2012-10-30
-
文件大小:245kb
-
已下载:1次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
一个表达式和一棵二叉树之间,存在着自然的对应关系。写一个程序,实现基于二叉树表示的算术表达式Expression的操作。
【基本要求】
【一】【必做部分】
假设算术表达式Expression内可以含有变量(a-z),常量(0-9)和二元运算符(+,-,*,/,^(乘幂))。实现以下操作:
(1)ReadExpr(E)――以字符序列的形式输入语法正确的前缀表达式并构造表达式E。
(2)WriteExpr(E)――用带括号的中缀表达式输出表达式E。
(3)Assign(V,c)――实现对变量V的赋值(V=c),变量的初值为0。
(4)Value(E)――对算术表达式E求值。
(5)CompoundExpr(p,E1,E2)――构造一个新的复合表达式(E1)p(E2)。
【二】【选做部分】
(1)以表达式的原书写形式输入,支持大于0的正整数常量;
(2)增加常数合并操作MergeConst(E)——合并表达式E中所有常数运算。例如,对表达式E=(2+3-a)*(b+3*4)进行合并常数的操作后,求得E=(5-a)*(b+12)
【测试数据】
1) 分别输入0;a -91 +a*bc +*5x2*8x +++*3^*2^x2x6并输出。
2) 每当输入一个表达式后,对其中的变量赋值,然后对表达式求值。
3) 还有很多测试的数据,详细请见附上的文件Test.txt。
-Between an expression and a binary tree, there is a natural correspondence. Write a program to realize the arithmetic expression based on Binary Tree for Expression of the operation.
Basic requirements of】 【
【1】 【will do some】
Suppose an arithmetic expression can contain variables in Expression (az), constant (0-9) and the binary operator (+,-,*,/,^( power)). To achieve the following:
(1) ReadExpr (E)- in the form of a sequence of characters enter the correct prefix expression syntax and constructs the expression E.
(2) WriteExpr (E)- with the infix expression with parentheses output expression E.
(3) Assign (V, c)- to achieve the assignment of the variable V (V = c), the variable s initial value is 0.
(4) Value (E)- E evaluation of arithmetic expressions.
(5) CompoundExpr (p, E1, E2)- construct a new complex expression (E1) p (E2).
【2】 【choose to do some】
(1) the original written form of expression input, support for constant positive integer greater than 0
(2)
【基本要求】
【一】【必做部分】
假设算术表达式Expression内可以含有变量(a-z),常量(0-9)和二元运算符(+,-,*,/,^(乘幂))。实现以下操作:
(1)ReadExpr(E)――以字符序列的形式输入语法正确的前缀表达式并构造表达式E。
(2)WriteExpr(E)――用带括号的中缀表达式输出表达式E。
(3)Assign(V,c)――实现对变量V的赋值(V=c),变量的初值为0。
(4)Value(E)――对算术表达式E求值。
(5)CompoundExpr(p,E1,E2)――构造一个新的复合表达式(E1)p(E2)。
【二】【选做部分】
(1)以表达式的原书写形式输入,支持大于0的正整数常量;
(2)增加常数合并操作MergeConst(E)——合并表达式E中所有常数运算。例如,对表达式E=(2+3-a)*(b+3*4)进行合并常数的操作后,求得E=(5-a)*(b+12)
【测试数据】
1) 分别输入0;a -91 +a*bc +*5x2*8x +++*3^*2^x2x6并输出。
2) 每当输入一个表达式后,对其中的变量赋值,然后对表达式求值。
3) 还有很多测试的数据,详细请见附上的文件Test.txt。
-Between an expression and a binary tree, there is a natural correspondence. Write a program to realize the arithmetic expression based on Binary Tree for Expression of the operation.
Basic requirements of】 【
【1】 【will do some】
Suppose an arithmetic expression can contain variables in Expression (az), constant (0-9) and the binary operator (+,-,*,/,^( power)). To achieve the following:
(1) ReadExpr (E)- in the form of a sequence of characters enter the correct prefix expression syntax and constructs the expression E.
(2) WriteExpr (E)- with the infix expression with parentheses output expression E.
(3) Assign (V, c)- to achieve the assignment of the variable V (V = c), the variable s initial value is 0.
(4) Value (E)- E evaluation of arithmetic expressions.
(5) CompoundExpr (p, E1, E2)- construct a new complex expression (E1) p (E2).
【2】 【choose to do some】
(1) the original written form of expression input, support for constant positive integer greater than 0
(2)
(系统自动生成,下载前可以参看下载内容)
下载文件列表
Expreesion/Assign.cpp
Expreesion/CompoundExpr.cpp
Expreesion/CreateBiTree.cpp
Expreesion/Debug/Assign.obj
Expreesion/Debug/CompoundExpr.obj
Expreesion/Debug/Diff.obj
Expreesion/Debug/Exist.obj
Expreesion/Debug/Expreesion.exe
Expreesion/Debug/Expreesion.ilk
Expreesion/Debug/Expreesion.obj
Expreesion/Debug/Expreesion.pch
Expreesion/Debug/Expreesion.pdb
Expreesion/Debug/Precede.obj
Expreesion/Debug/Print.obj
Expreesion/Debug/ReadExpr.obj
Expreesion/Debug/StdAfx.obj
Expreesion/Debug/Type.obj
Expreesion/Debug/Value.obj
Expreesion/Debug/vc60.idb
Expreesion/Debug/vc60.pdb
Expreesion/Debug/WriteExpr.obj
Expreesion/Exist.cpp
Expreesion/Expr.h
Expreesion/Expreesion.cpp
Expreesion/Expreesion.dsp
Expreesion/Expreesion.dsw
Expreesion/Expreesion.ncb
Expreesion/Expreesion.opt
Expreesion/Expreesion.plg
Expreesion/InOrderTraverse
Expreesion/InOrderTraverse.cpp
Expreesion/IsOperand.cpp
Expreesion/Parent.cpp
Expreesion/Precede.cpp
Expreesion/Print.cpp
Expreesion/ReadExpr.cpp
Expreesion/ReadMe.txt
Expreesion/StdAfx.cpp
Expreesion/StdAfx.h
Expreesion/Type.cpp
Expreesion/Value.cpp
Expreesion/WriteExpr.cpp
Expreesion/新建文本文档.txt
Expreesion/Debug
Expreesion
Expreesion/CompoundExpr.cpp
Expreesion/CreateBiTree.cpp
Expreesion/Debug/Assign.obj
Expreesion/Debug/CompoundExpr.obj
Expreesion/Debug/Diff.obj
Expreesion/Debug/Exist.obj
Expreesion/Debug/Expreesion.exe
Expreesion/Debug/Expreesion.ilk
Expreesion/Debug/Expreesion.obj
Expreesion/Debug/Expreesion.pch
Expreesion/Debug/Expreesion.pdb
Expreesion/Debug/Precede.obj
Expreesion/Debug/Print.obj
Expreesion/Debug/ReadExpr.obj
Expreesion/Debug/StdAfx.obj
Expreesion/Debug/Type.obj
Expreesion/Debug/Value.obj
Expreesion/Debug/vc60.idb
Expreesion/Debug/vc60.pdb
Expreesion/Debug/WriteExpr.obj
Expreesion/Exist.cpp
Expreesion/Expr.h
Expreesion/Expreesion.cpp
Expreesion/Expreesion.dsp
Expreesion/Expreesion.dsw
Expreesion/Expreesion.ncb
Expreesion/Expreesion.opt
Expreesion/Expreesion.plg
Expreesion/InOrderTraverse
Expreesion/InOrderTraverse.cpp
Expreesion/IsOperand.cpp
Expreesion/Parent.cpp
Expreesion/Precede.cpp
Expreesion/Print.cpp
Expreesion/ReadExpr.cpp
Expreesion/ReadMe.txt
Expreesion/StdAfx.cpp
Expreesion/StdAfx.h
Expreesion/Type.cpp
Expreesion/Value.cpp
Expreesion/WriteExpr.cpp
Expreesion/新建文本文档.txt
Expreesion/Debug
Expreesion
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.