Question: Write an integer calculator. This should be able to handle +, -, / (integer division), and *(integer multiplying) until a '#' character is reached instead
Write an integer calculator. This should be able to handle +, -, / (integer division), and *(integer multiplying) until a '#' character is reached instead of an operation. Ignore order of operations as well, and always assume the left operations are done first. For eample: 2+3/5 = 5/5 = 1. You should then show the result (you do not need to show the original equation). As this is an integer calculator you may assume they enter only integers and valid operations (or the stopping character). Detect an error if you enter just a '#'.
Example 1(user input is underlined):
Enter an equation: 2+3*2#
10
Example 2 (user input is underlined):
Enter an equation: 2+3*2/5000+94#
5
Example 3 (user input is underlined):
Enter an equation: 2/3#
0
Example 4 (user input is underlined):
Enter an equation: 7#
7
Example 5 (user input is underlined):
Enter an equation: #
Error
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
