Write a program that mimics a calculator. The program should take as inputs two integers and
the operation 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.) Some sample outputs
follow:
3 + 4 = 7
13 * 5 = 65
10 – 5 = 5
30 / 0 = Error: Division-by-Zero!
14 & 7 = Error: Invalid Operation!
1
Expert's answer
2013-09-25T13:48:07-0400
#include<iostream> using namespace std;
int main() { int var1, var2; char operation;
cout << "Enter the first number : "; cin >> var1; cout << endl;
cout <<"Enter the operation to be perfomed : "; cin >> operation; cout << endl;
cout << "Enter the second nuber : "; cin >> var2; cout << endl;
Comments
Leave a comment