Description:

    An arithmetic _expression involving the binary operators addition 
(+), subtraction (-), multiplication (*), and division (/) can be 
represented by using a binary _expression tree. In a binary 
_expression tree, each operator has two children, which are either 
operands or sub expressions. Leaf nodes contain an operand which is a 
single digit in the range from 0 through 9. No leaf nodes contain a 
binary operator. The left and right sub trees of an operator describe 
a sub _expression that is evaluated and used as one of the operands 
for the operator.  

 

Requirements: 


The program should display the following command base menu when the 
it runs: 

press 'i'  to enter an infix _expression.

press 'p'  to show the prefix _expression of the given infix 
_expression.

press 't'  to show the postfix _expression of the given infix 
_expression.

press 'e'  to evaluate the value of the postfix _expression.

press 'x'  to exit the program.

        //  YOU MUST USE THESE PROTOTYPED FUNCTIONS TO ORGANIZE YOUR 
CODE.

 

 

 

               // check the validity of the _expression by checking 
each character in this string from 0-9 and operators ( +, -, *, / )

                      returns 1 if _expression is valid.

                 int    isValid (const string &exp ) {

 

                     // write your code here.

 

                 }

 

 

               // evaluates the given postfix _expression and returns 
the result. 

                 int    evaluatePostfix ( const string &exp) {

 

                     // write your code here.

 

                 }

 

 

               // converts the infix _expression to postfix and 
returns it.

               string   toPostfix ( const string &exp ) {

 

                     // write your code here.

 

                 }

 

 

               // converts the infix _expression to prefix and 
returns it.

               string   toPretfix ( const string &exp )  {

 

                     // write your code here.

 

                 }

Plz send me the .h and .cpp files separately urngent please.

 










------------------------ Yahoo! Groups Sponsor --------------------~--> 
$4.98 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/Q7_YsB/neXJAA/yQLSAA/EbFolB/TM
--------------------------------------------------------------------~-> 

To unsubscribe : [EMAIL PROTECTED]

 
Yahoo! Groups Links

<*> To reply to this message, go to:
    
http://groups.yahoo.com/group/Programmers-Town/post?act=reply&messageNum=4915
    Please do not reply to this message via email. More information here:
    http://help.yahoo.com/help/us/groups/messages/messages-23.html

<*> To visit your group on the web, go to:  
    http://groups.yahoo.com/group/Programmers-Town/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to