Purchase Solution

Converting Infix to Postfix with C++

Not what you're looking for?

Ask Custom Question

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

Purchase this Solution

Solution Summary

The expert converts Inflix to Postfix with C++.

Purchase this Solution


Free BrainMass Quizzes
Javscript Basics

Quiz on basics of javascript programming language.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.