Write a program to evaluate infix expressions

Assignment Help C/C++ Programming
Reference no: EM13320762

Prerequisites:

Before starting this programming assignment, participants should be able to:

Analyze a basic set of requirements for a problem

Compose C language programs

Create basic test cases for a program

Apply arrays, strings, and pointers

Summarize differences between array notation and pointer notation

Apply pointer arithmetic

Apply basic string handling library functions

Define and implement structures in C

Summarize the operations of a linked list

Describe the operations of a stack including: push (), pop (), peek () 

Overview & Requirements:

Write a program to evaluate infix expressions. An infix expression looks like the following:

9 * (5 - 4) + 2 / 6

This program must first convert the infix expression to a postfix expression, and then evaluate the postfix expression. A postfix expression for the above infix expression looks like the following:

9 5 4 - * 2 6 / +

For this assignment you will need to implement and apply one stack to convert from infix to postfix, and implement and apply a second stack to evaluate the postfix expression.

Please complete exercises 12.12 and 12.13 form your Deitel & Deitel C How to Program textbook. These exercises provide you with the algorithms required to perform the correct conversions and evaluations. Create a single program only, which combines both exercises. Also, be sure to allow the user to continue to enter infix expressions until they want to quit the program.

BONUS:

Provide appropriate test cases and drivers for each function in your stack application to receive up to 10 bonus points. For an additional 10 points allow for your program to accept multi-digit operands and unary sign operators (+ and -).

the assignment will be evaluated based on a successful compilation and adherence to the program requirements. We will grade according to the following criteria:

1) - Appropriate top-down design, style, and commenting according to class standards

2) - Correct stack function implementations

3) - Correct usage of infix stack

4) - Correct usage of postfix stack

Reference no: EM13320762

Questions Cloud

Calculate the net impulse : Calculate the net impulse delivered to a 138-kg quarterback initally running at 4.5 m/s if he's hit by a defending player and slowed to a speed of 1.1 m/s
Dealing with differnt stakeholder groups : Explain how ethics help managers determine the right way to behave when dealing with differnt stakeholder groups? Use Costco, General Electric, McDonald's and other businesses in your explanation.
What are the wavelengths of the first two overtones : We all sound like great singers in the shower, due to standing waves. What are the wavelengths of the first two overtones for this shower
How close should you come : You are trying to overhear a juicy conversation, but from your distance of 16.0m , How close should you come
Write a program to evaluate infix expressions : Write a program to evaluate infix expressions and summarize differences between array notation and pointer notation
Explain why the normal force the track exerts on the coaster : A roller coaster is riding along the rails at an amusement park. Explain why the normal force the track exerts on the coaster does zero work on it
What is the distance between blood sample and objective lens : To examine a particular blood sample in biology lab, a student uses a compound microscope set to have a magnification of -4530. What is the distance between the blood sample and the objective lens
Construct a ray diagram showing the location of image : An object is a distance 6f from a converging lens. construct a ray diagram showing the location and orientation of the image
Delegates to the national conventions : The primary election as a means of choosing the states’ delegates to the national conventions where the presidential nominee is formally selected

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a complete c++ program

The main program will read in a parameter value n (read this in main). Then it will call a function read2arrays (details below) to read lists of grades into two arrays, which the main program will call test1 and test2 (or some other names of your ..

  Create a road class

Create a Road class. The class should have functions for setting the width of the road in feet and the length of the road in miles. It should also have functions for obtaining the width of the road the length of the road

  Write a c program that reads in five numbers

Q1. (Bar Chart /Histogram printing) Write a C program that reads in five numbers (each between 1 and 30). For each number read, your program should print a line containing that number of adjacent asterisks. For example, if your program reads the numb..

  Write a program that inputs a dollar amount to be printed

Write a program that inputs a dollar amount to be printed on a check and then prints the amount in check-protected format with leading asterisks if necessary

  Design is known, what advantages does keeping

Given that the design is known, what advantages does keeping the source code unavailable give the company and those who purchase the software? What disadvantages does it cause?

  The actual solution of the equation shall be done

The actual solution of the equation shall be done by a function named equSolver(), which takes three coefficients as parameters and returns a structure of three fields: two roots (if they exist) and a boolean indicator, whether the roots do exist.

  Write an application that creates a quiz

Write an application that creates a quiz, which contains at least 5 questions about a hobby, popular music, astronomy, or any other personal interest. Each question can be multiple choice(a,b,c,d should be user accepted response), or true or false(t ..

  Use numbers 0 through 23 to represent hours

Write a C function seconds_since_jan1() that takes the time as six integer arguments (year, month, day, hour,minute, and second) and returns the number of seconds since the beginning of the year. Use numbers 1 through 12 to represent months. Use numb..

  Write a script that creates a craps game

Write a script that creates a craps game and meets the following requirements. Name the script craps.sh The script will get 2 random numbers between 1-6.

  Write function to find whether number is perfect number

Write down the function perfect which determines whether number is perfect number or not. This function must receive number and return true if number is perfect.

  Make a class employee

Make a class EMPLOYEE with a name and salary. Make a class MANAGER inherit from EMPLOYEE. Add an instance field, named DEPARTMENT

  Write down a program which will calculate and displays min

write down a program which will calculate and displays the min temperature and the maximum temperature for seven days of a week.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd