C++ Programming Exercise: Implement a command-line calculator that allows the us
ID: 646050 • Letter: C
Question
C++ Programming Exercise:
Implement a command-line calculator that allows the user to enter an expression containing numbers, variables, brackets, and operators. The calculator will also allow assignments to a variable. After the user enters the expression the program will evaluate it and display the value. If the expression is part of an assignment its value will be also be stored in the variable. The operators are +, -, *, /, % and ^ (exponentiation). (These are all binary operators.) % should be applicable to floating point numbers and work like it does in Java. There are three types of bracket: parentheses ( ( ) ) , square brackets ( [ ] ) and braces ( {} ). A variable may be any single lowercase letter. (Uninitialized variables can have any value.) The calculator will loop until the user enters a blank line. Here is a sample run below:
> 3 + 4.5
7.5
> a = 6*2/5
2.4
> b = a+1
3.4
> b
3.4
> c = b^2
11.56
> a * {b
Explanation / Answer
I have code another one for the same as above., Please go through it.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.