Question
I need help to convert this program and FUNCTIONS of C++ to Python #include #include using namespace std; int x, y, result; string op; int
I need help to convert this program and FUNCTIONS of C++ to Python
#include
int x, y, result; string op;
int Add(int x, int y) { result = x + y;
return result;
} int Division(int x, int y) { result = x / y;
return result;
} int Multiplication(int x, int y) { result = x * y;
return result;
} int Substraction(int x, int y) { result = x - y;
return result;
}
int main() {
cout << "Please make a selection 1. Addition 2. Division 3. Multiplication 4. Subtraction 0. to EXIT ->>"; cin >> op;
if (op == "1") { cout << "Please enter the first number "; cin >> x; cout << "Please enter the second number "; cin >> y; result = Add(x, y); cout << result; } else if (op == "2") { cout << "Please enter the first number "; cin >> x; cout << "Please enter the second number"; cin >> y; result = Division(x, y); cout << result; } else if (op == "3") { cout << "Please enter the first number "; cin >> x; cout << "Please enter the second number "; cin >> y; result = Multiplication(x, y); cout << result; } else if (op == "4") { cout << "Please enter the first number "; cin >> x; cout << "Please enter the second number "; cin >> y; result = Substraction(x, y); cout << result; } else if (op == "0") { cout << "GoodBye"; }
return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started