rendered paste body#include <iostream>
using namespace std;
int main ()
{
char choice;
int num1, num2, num3;
cout <<"Menu" <<endl;
cout <<"=============" <<endl;
cout <<"+) Add" <<endl;
cout <<"-) Subtract" <<endl;
cout <<"*) Multiply" <<endl;
cout <<"/) Divide" <<endl;
cout <<"x) Exit" <<endl;
cout <<"==============" <<endl;
cout <<"Enter your choice: ";
cin >> choice;
choice = tolower(choice);
if (choice != '+' || choice != '-' || choice != '*' || choice != '/' || choice != 'x')
cout <<"Valid choices are +, -, *, /, or x." <<endl;
else
{
switch (choice)
{
case '+':
{ cout <<"Enter the two operands: ";
cin >> num1 >> num2;
num3 = num1 + num2;
cout << num1 <<" + " << num2 <<" is " << num3 <<endl;
}
break;
case '-':
{ cout <<"Enter the two operands: ";
cin >> num1 >> num2;
num3 = num1 - num2;
cout << num1 <<" - " << num2 <<" is " << num3 << endl;
}
break;
case '*':
{ cout <<"Enter the two operands: ";
cin >> num1 >> num2;
num3 = num1 * num2;
cout << num1 <<" * " << num2 <<" is " << num3 <<endl;
}
break;
case '/':
{ cout <<"Enter the two operands: ";
cin >> num1 >> num2;
if (num2 == 0)
cout <<"Division by zero is not possible. " <<endl;
else
{
num3 = num1 / num2;
cout << num1 <<" / " << num2 <<" is " << num3 <<endl;
}
}
break;
case 'x': cout <<"You have chosen to exit the program." <<endl;
break;
}
}
}