C++ project v1 2017

Implement an infinite precision arithmetic package for non-negative integers and a stack-based calculator that
operates on infinite precision values, along with support list and stack classes to support your solution.
Details
The input to this program should be read from standard input and the output should be directed to standard
output. The name of the program should be Project1.
The input will consist of a series of arithmetic expressions given in postfix orĀ  PReverseolish Notation (RPN).
In RPN, the operands come before the operator . For example, you normally see multiplication written in infix
notation as (a * b). In RPN, this expression would appear as (a b *). For expressions with more than one
operator , each time an operator is encountered, it is applied to the two immediately preceding subexpressions. For example, (a + b * c) in infix notation would be (a b c * +) in RPN. This means that
operands b and c are multiplied, then the results of the multiplication are added to operand a. In RPN,
operator precedence is not required because operators are always evaluated left to right. Thus, the
expression ((a + b) * c) is written (a b + c *) in RPN.
Input operands consist of a string of digits, and may be of any length. Y ou should trim any zeros appearing at
the beginning of an operand (e.g. 000231 should be stored as 231). Expressions may also be of any length.
Spaces and line breaks may appear within the expression arbitrarily , with the rule that a space or line break
terminates an operand, and a blank line (i.e., two line breaks in a row) terminates an expression.
The operations are limited to addition (+), multiplication (*), and exponentiation (^). An error should be
reported whenever the number of operators and operands are inconsistent (i.e., if there are no operands to
the left of an operator , or if the expression ends without providing sufficient operators).
When an error is detected, processing should stop on the current expression, and your program should
proceed to the next expression. For each expression, echo the input, followed by the result of the operation, or
an error message, as appropriate. Be sure that the result is clearly marked on the output for readability .
Powered by