Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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). 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.

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).

(Using VS17Express)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions

Question

What is management growth? What are its factors

Answered: 1 week ago