Question
(Using VS17Express) Write a C++ program that mimics a calculator. The program should take as input two integers and the operation to be performed. The
(Using VS17Express)
Write a C++ program that mimics a calculator. The program should take as input two integers and the operation to be performed. The operator should be read as a char variable. It should then output the numbers, the operator and the result. For division and the mod operator, if the denominator is zero, output an error message. Assume the first number is the numerator and the second is the denominator for division operations. Your program should do the following operations: + (plus), - (minus), * (multiplication), / (division), and the % (mod operator for the remainder).
You can also implement a few other functions. Square root (use the r symbol), absolute value (use the a symbol), and/or the reciprocal function (use the p symbol).
Some sample outputs follow:
Enter the first number:
5
Enter the second number:
6
Enter the operator:
+
Your result is:
5+6=11
Thank you for using my calculator.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started