Write a program thatmimics a calculator. The program should take as input two in
ID: 3614873 • Letter: W
Question
Write a program thatmimics a calculator. The program should take as input two integersand the operator that the operation to be performed. It should thenoutput the numbers, the operators, and theresult.
(For division,if the denominator is zero, output an appropriatemessage)
Note: pleaseuse the switch syntax to solve this problem.
Some sampleoutputs follow:
3 + 4 =7
13 * 5 =65
Explanation / Answer
Code: #include int main(void) { int a; int b; int result; char op; std::cout a; std::cin >>op; std::cin >> b; switch (op) { case '+': result = a + b; break; case '-': result = a - b; break; case '*': result = a * b; break; case '/': if (b == 0) { std::coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.