Question: C++ Programming Language This will be your first C++ program. Problem: Write a program, named p5.cpp, that behaves in the manner described by the usage

C++ Programming Language

C++ Programming Language This will be your first C++ program. Problem: Write

This will be your first C++ program. Problem: Write a program, named p5.cpp, that behaves in the manner described by the usage material in previous assignments and including the additional operators listed below. Input and output must use standard C--I O stream objects cin, cout and cerr, which are linked to stdin, stdout and stderr respectively. Usage text must be written to stdout while error messages must by written to stderr. You may also use the class stringstream as a tool to help in determining whether an input token is a number or not. There are also four additional operators to be added as follows. . : Inversion - push(1.0 / popO); Negation - push(-pop(); . ** : Exponentiation - temp = pop(); push(pow(pop(), temp)); peek : display the top-of-stack value without removing the value from the stack. You must revise the usage text to include these operators, properly described, as shown below. Output: Your program's normal output must be to stdout and of one of the formats following, assuming argc and argv are the usual parameters for main() and where " --help" display this usage material. " -postfix" The program accepts input from standard input as a sequence of numbers and operators. The numbers (operands, as integers or floating point numbers) read are pushed on a stack until needed. When an operator is read, the required operands are popped from the stack and used to perform the calculation, with the result placed on the stack. Valid operators are +, -, * and 7, are interpreted as addition, subtraction, multiplication and division, respectively, as described below. An additional operator is =, which indicates that the value at the top of the stack is popped from the stack and displayed along with the number of values remaining on the stack, whereupon the program terminates. Stack under flows generate an error message and halt the program, as do a stack Overflows. Unrecognized input tokens produce error messages and result in program termination, as do unrecognized command line arguments. The size of the stack is 10. This will be your first C++ program. Problem: Write a program, named p5.cpp, that behaves in the manner described by the usage material in previous assignments and including the additional operators listed below. Input and output must use standard C--I O stream objects cin, cout and cerr, which are linked to stdin, stdout and stderr respectively. Usage text must be written to stdout while error messages must by written to stderr. You may also use the class stringstream as a tool to help in determining whether an input token is a number or not. There are also four additional operators to be added as follows. . : Inversion - push(1.0 / popO); Negation - push(-pop(); . ** : Exponentiation - temp = pop(); push(pow(pop(), temp)); peek : display the top-of-stack value without removing the value from the stack. You must revise the usage text to include these operators, properly described, as shown below. Output: Your program's normal output must be to stdout and of one of the formats following, assuming argc and argv are the usual parameters for main() and where " --help" display this usage material. " -postfix" The program accepts input from standard input as a sequence of numbers and operators. The numbers (operands, as integers or floating point numbers) read are pushed on a stack until needed. When an operator is read, the required operands are popped from the stack and used to perform the calculation, with the result placed on the stack. Valid operators are +, -, * and 7, are interpreted as addition, subtraction, multiplication and division, respectively, as described below. An additional operator is =, which indicates that the value at the top of the stack is popped from the stack and displayed along with the number of values remaining on the stack, whereupon the program terminates. Stack under flows generate an error message and halt the program, as do a stack Overflows. Unrecognized input tokens produce error messages and result in program termination, as do unrecognized command line arguments. The size of the stack is 10

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!