Question: Write a C++ program (Q1.cpp) that takes simple, one operand arithmetic operations from the command line and calculates the result. The program should accept signed

Write a C++ program (Q1.cpp) that takes simple, one operand arithmetic operations from the command line and calculates the result. The program should accept signed integers as operands, and support the , +, operators. When provided to the command line, operands and operators should be separated by a space, in the following way: 3+5 For the division operator, you should treat it as an integer division (no decimals). You should consider the error conditions listed in the sample runs below, and terminate the program if such a condition occurs. Text in in the examples demonstrates the user inputs entered via the keyboard. The actual user inputs should not contain or> signs. Sample run 1: Enter an expression to evaluate: Result: 8 Sample run 2: Enter an expression to evaluate: Error! You can't divide a number by O! Sample run 3: Enter an expression to evaluate: Error! %, is not a supported operator
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
