|
Question No. 1: (20 marks)
Write a C++ program that takes an infix expression and convert it into a prefix expression.
Note: Your Submission must include:
1. A working MakeFile (Dev-C++ project File).
2. All the Source Code(.h and .cpp files) necessary to compile and run your program.
3. Upload all the files on VULMS in a zip folder.
Note: Use Dev-C++ 4.9.7.0 which is available at VULMS.
Question No. 2: (5 marks)
Apply the evaluation algorithm to evaluate the following postfix expression? Assume , , .
CBA+*ABC-+*
Write each step of this conversion using the following table.
|
Input
|
op1
|
op2
|
value
|
stack
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Question No. 3: (5 marks) Convert the following infix expression
(A+B)/(C-(D-E)*F)-G
into postfix expression. Show the trace of the conversion steps, i.e., the stack, the infix expression and postfix expression, using the following table.
|
Step No.
|
Stack
|
Infix
|
Postfix
|
|
|
|
|
|
|