Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have a question on an assignment. I have my code available and just want someo

ID: 643396 • Letter: I

Question

I have a question on an assignment. I have my code available and just want someone to look over it using MS VS 2010 express, for that is what my instructor is using.

Write a program that mimics a calculator. The program should take as input two integers and the opreation to be performed. It should then output the numbers, the operator, and the result. (For division, if the denominator is zero, output an appropriate message.)

Explanation / Answer

I made the assumption that each part of the expression is to be entered separately, and that the user wants to carry out a single calculation each time the program runs. Code follows. //begin calc.cc #include #include #include using namespace std; int main() { int a, b, c; char op; cout > a; cout > b; cout > op; switch (op) { case '+': c = a+b; break; case '-': c = a-b; break; case '*': c = a*b; break; case '/': if (b == 0) { cout