Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write 3 individual c ++ programs that use a stack to work with infix / postfix equations and equation verification. Verify equations based on balanced

Write 3 individual c ++ programs that use a stack to work with infix / postfix equations and equation verification.

  1. Verify equations based on balanced parentheses, brackets, and curly braces. (50)
    1. Examples of good equations:
      1. (a + b)/c
      2. (2-1)+(2+3)
      3. {[(a + b) * a]/b} + 1
      4. a + (b /c)
    2. Examples of bad equations:
      1. (a + b/c
      2. ()((())
      3. {if you eat a lot}/(you will belch)
  2. Evaluate post fix equations.(100)
    1. Example:
      1. 1 2 + 3 * => results in 6
      2. 2 3 3 + * => results in 12
  3. Infix to PostFix (100)
    1. Example:
      1. (a + b)*c => ab+c*
      2. a + b * c => abc*+

4. Take all of the above c++ programs and combine them into one separate program.

Requirements:

1. Must be in c++;

2. No built in types. must make own functions and classes.

3. Make it as simple as possible.

*Write a snippet of code into the main program that combines all 3 programs to read in the test values from a text file.

Test Material:

1. parentheses tests

x = ((1 + 2)*3

x = (1 + 2))*3

y = (z * j)/(b * 8)^2

2. postfix equation solving

7 3 + 9 *

5 2 + 1 9 * *

8 9 * 3 5 + -

2 + 8 4 /

3. infix to postfix conversion

(8 + 4) * 9

(6 + 3) * (2 * 8)

(9 * 8) (5 + 3)

3 + (9 / 3)

4. Parentheses check, infix to postfix conversion, postfix evaluation

(8 + 4) * 9

(6 + 3) * (2 * 8)

(9 * 8) (5 + 3)

3 + (9 / 3)

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

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

More Books

Students also viewed these Databases questions