Question & Answer: Write a program that mimics a calculator. the program should take as input two integer…..

Write a program that mimics a calculator. the program should take as input two integers and an arithmetic operation to be performed. It should then output the appropriate message. Sample program output: Enter the first integer 25 Enter the second integer: 30 Enter operator: +(addition), (subtraction), * (multiplication), / (division): 25 + 30 = 55 Dev C++

Write a program that mimics a calculator. the program should take as input two integers and an arithmetic operation (+, -, * ot/) 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. Sample program output: Enter the first integer 25 Enter the second integer: 30 Enter operator: +(addition), (subtraction), * (multiplication), /(division): + 25 + 30 = 55

Expert Answer

 

code.cpp

#include <iostream>

using namespace std;

int main() {

int a, b, c;

char operation;

cout<<“Enter the first integer : “;

cin>>a;

cout<<“n Enter the second integer : “;

cin>>b;

cout<<“Enter Operator : + (addition) , – (subtraction) , * (multiplication), / (division) : “;

cin>>operation;

if(operation == ‘+’){

c = a+b;

cout<<a<<” + “<<b<<” = “<<c;

}

else{

if(operation == ‘-‘){

c = a-b;

cout<<a<<” – “<<b<<” = “<<c;

}

else{

if(operation == ‘*’){

c = a*b;

cout<<a<<” * “<<b<<” = “<<c;

}

else{

if(operation == ‘/’){

c = a/b;

cout<<a<<” / “<<b<<” = “<<c;

}

}

}

}

 

 

 

 

return 0;

}

OUTPUT:

Question & Answer: Write a program that mimics a calculator. the program should take as input two integer..... 1

 

Still stressed from student homework?
Get quality assistance from academic writers!