Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN C++ help In this program you will write two fumctions: 1 INFX TO POSTFIX -converts infix expression to postfix using stack and queue 2.

IN C++ help

image text in transcribed

In this program you will write two fumctions: 1 INFX TO POSTFIX -converts infix expression to postfix using stack and queue 2. EVALUATE_POSTFIX -evaluates postfix expression using a stack You will also need PUSH, POP, and other procedures for manipulating stacks. You must implement stack and queue, as defined in the textbook or a style of similar. You cannot just make a function call to the standard stack or The stack and queue functions must be in your own code. The infix expressions to be evaluated are follows. Your main program reads in an infix expression, calls INFIX TO POSTFIX to convert it to postfix form, and then calls EVALUATE_POSTFIX to evaluate it. For each infix expression, your program should print the original infix expression, its postfix expression, and the result of the evaluation (that is, the value of the expression). Your program should check for end-of-file and stop when there are no more infix expressions. After processing all the expressions, yor program should print a final line that is the sum of all the values. The Evaluation can use a stack of floats, and the evaluation results are in floats and you may limit to two digits after decimal point. The only operators used in the infix expressions are multiplication *), division (). additioin (+), subtraction (-), and exponential (. Standard C++ precedence rules are observed. Parentheses are also used. As is customary, anything within parenthesis is evaluated before anything else is evaluated. You may assume there will be no unary minus. All operands are one-digit decimal numbers with no decimal point. The result of each calculation should be loat. The input data file name should be "a2.tt Sample Test Data: 8-3+2 7+ (4-6) (8+6) /3 0/1+4 5 9-2+((4-a) 2)/2 Stack and queue examples can be found in the textbook. You may use arrays to implement stacks and queues, but they have to be defined with functionalities of stack and queue

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

1 2 3 Data Base Techniques

Authors: Dick Andersen

1st Edition

0880223464, 978-0880223461

More Books

Students also viewed these Databases questions

Question

Explain walter's model of dividend policy.

Answered: 1 week ago