(1374 Views)

Below is a simple Calculator program written in C++ which performs operations like Addition, Subtraction, Multiplication, Division and Swapping.

- The first value as an operator should be a char type and one of (+, -, *, /, s) characters which has the following meanings:
- '+' for addition (num1 + num2)
- '-' for subtraction (num1 - num2)
- '*' for multiplication (num1 * num2)
- '/' for division (num1 / num2)
- 's' for swap

- Program receives another two operands (Num1, Num2) which can be a float or an integer
- The program calculates the appropriate result as per the operation specified and prints the relevant results with related message on console
- Swap operator just exchanges the content of two variables

2 UpvotesUpvote |
0 DownvotesDownvote |

- How to Check if Android Device Supports Connecting to USB Devices [1046 Views]
- How to Check if Android Device has NFC Feature programmatically in Android Studio [1038 Views]
- 0/1 Knapsack problem with solution [6454 Views]
- Flowchart and Algorithm for calculating X to the Power of Y i.e X
^{Y}[1372 Views] - Algorithm to find whether a Number is Prime Number or Not [8850 Views]

- How To Win Ludo King Game Every Time [31964 Views]
- Algorithm to find whether number is Armstrong Number or Not [30442 Views]
- Knuth-Morris-Pratt (KMP) Substring Search Algorithm with Java Example [24942 Views]
- Jio Phone hang on LOGO problem Solution - Hard Reset Jio Phone [21834 Views]
- FlowChart and Algorithm to find Whether a Number is Even or Odd [16278 Views]