Write a program that evaluates an arithmetic expression in infix notation, without full parentheses. Use the following

Question:

Write a program that evaluates an arithmetic expression in infix notation, without full parentheses. Use the following algorithm: There are two stacks: a numbers stack and an operators stack. When a number appears, push it onto the numbers stack. Any parenthesis or operator should be treated as described in Step 2 of Figure 6.10 on page 351—with one change. Whenever you pop an operation off the stack, you should immediately use that operation by popping two numbers, applying the operation, and pushing the answer back on the numbers stack.

FIGURE 6.10 Converting an Infix Expression to a Postfix Expression (General Case) Pseudocode 1. Initialize a stack of characters to hold the operation symbols and parentheses. 2. do if (the next input is a left parenthesis) Read the left parenthesis and push it onto the stack. else if (the next

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: