In C++:
#include <iostream>
using namespace std;
int main()
{
int x, y;
char func;
cout << "Enter a number: ";
cin >> x;
cout << "Choose Function: ";
cin >> func;
cout << "Enter another number: ";
cin >> y;
switch(func)
{
case '+':
cout << x + y << endl;
break;
case '-':
cout << x - y << endl;
break;
case '*':
cout << x * y << endl;
break;
case '/':
cout << x / y << endl;
break;
default:
cout << "Invalid Function!" << endl;
break;
}
char wait;
cin >> wait;
return 0;
}
Chat with our AI personalities