Convert infix to postfix expression

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

For every postfix expression there exists a corresponding and uniquely defined infix expression that evaluates to the same number. The converse is not true. The infix expression a + b + c can be represented as either abc++ or ab+c+ in postfix. The reason for the ambiguity is the lack of brackets in the infix expression.

If the infix expression were "fully bracketed" there would be no ambiguity.Thus (a + b) + c pairs with ab+c+ and a + (b + c) pairs with abc++.

Example: the "fully bracketed" version of an expression a + b*c/d is (a + ((b*c)/d)).

The program should do:

* Take an infix expression from the standard input

* The expression must consist of digits (for numbers), symbols '(' and ')', and operations ('+', '-', '*', '/')
The terms in the expression might or might not be separated by one or several spaces, e.g. ( (56 + 32)* (16 -7))

* Convert the expression into the postfix form

* Output the postfix form to the screen

* Evaluate the resulting postfix expression

* Output the result

Reference no: EM13937074

Questions Cloud

Outlining the key ideas and the sequence : First of all, you are to prepare a background paper on your overall topic, briefly outlining the key ideas and the sequence of learning from Foundation Year to Year 7, but focused on ‘locating' your particular sub-topic and learning objectives wit..
Prepare the operating profit statement for mikkeli oy : Prepare the operating profit statement for Mikkeli Oy for the second quarter of 2005. Assume that revenues and operating results are identical to the first quarter except.
How to develop a promotion strategy : Q1. How to develop a promotion (marketing communication) strategy Q2. What sort of promotional strategy would you develop Both questions with 300-400 words each.
Describe his major contribution to astronomy : Prepare a brief biography for a major contributor to the field of astronomy. Describe his major contribution(s) to astronomy.
Convert infix to postfix expression : For every postfix expression there exists a corresponding and uniquely defined infix expression that evaluates to the same number.
What are the pricing objectives and policies : What are the pricing objectives, policies, strategies and procedures? To what extent are prices set on sound cost, demand and competitive criteria?
Simple eigenvalue of a diagonalizable matrix : Let be a simple eigenvalue of a diagonalizable matrix with right and left eigenvectors and , and let be the corresponding eigenvalue of the matrix . Show that to first order it holds that Hint: Consider the perturbed eigenvalue equation .
Select a peer-reviewed article on gender and health : Select a peer-reviewed article on "gender and health," or "ethnicity and health," or "socioeconomic class and health," then answer the following questions:Critique the methods used in these findings. What is your opinion on the validity of the findin..
How to use classes with private and public variables in c++. : I am trying to learn about how to use classes with private and public variables in c++. I've got a conversion program that I would like to use as a prop.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Implement uniform random number generator

Implement Uniform Random Number generator and Generate 1000 Random number between 0 an 10000.

  Design and implement a class called cheetah

Create a method that calculates the time required to travel between the starting point and stopping point of the line based on a given speed.

  Create a front­end system for a vending machine

Create a front­end system for a vending machine written in C. The vending machine serves all kinds of pastry treats. The company's name is Penelope's Pastry Delights and as such, the executable you are creating will be called "ppd"

  Write a function int frequency

Write a function int frequency (int theArray [ ], int n, int x) that counts the number of times the item x appears among the first n elements of theArray and returns that count as the frequency of x in theArray. Use integers for everything!

  Develop an application for the game of memory

Use object-oriented programming to develop an application for the game of memory. Memory consists of a 20 × 20 grid of face down cards where there is at most one pair of each card in the grid. The types of cards that are available in this versi..

  Calculating the gcd greatest common divisor

Write a C++ code for calculating the GCD Greatest Common Divisor between two positive integer numbers. You  should  use Euclid's  original  subtraction  based  GCD algorithm ( not  using  modulo operator).

  Describe an example application of polymorphism

Provide and describe an example application of polymorphism that could be used in a program solution. List and describe the class relationships.

  Write programme that allows a user to enter distinct words

Write a programme that allows a user to enter three distinct words and returns them as a single string

  Algorithm and create a flowchart

Write an algorithm and create a flowchart which simulate the testing for cell phone PIN. If the user entered the correct pin code, display "Welcome to DLM Telecom".

  Program to declare array alpha of components of type int

Write C++ statements to do the following: Declare an array alpha of 15 components of the type int. Output the value of the tenth component of the array alpha.

  Write a program in which set up a douhly-subscripted array

Write a program in which you set up a douhly-subscripted array to store each character in the wit. Ube ;old loops, and the most efficient  statements to do it. Include documentation (comment stmts.) in your program.

  Write a very basic doubly-linked list

CptS 122 Lab #2: Linked Lists ,  Along with vectors, linked lists are one of the fundamental data structures in computer science. Unlike vectors, which store information in a contiguous block of computer memory, linked lists have the potential to sto..

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