Calculator
Lesson 18Author : 🦒
Last Updated : November, 2017
Code
int num1, num2;
char op;
cout << "Enter num1: ";
cin >> num1;
cout << "Enter Operator: ";
cin >> op;
cout << "Enter num2: ";
cin >> num2;
if(op == '+'){
cout << num1 + num2 << endl;
} else if(op == '-'){
cout << num1 - num2 << endl;
} else if(op == '/'){
cout << num1 / num2 << endl;
} else if(op == '*'){
cout << num1 * num2 << endl;
} else {
cout << "Invalid Operator" << endl;
}