Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- float a, b;
- char operation;
- cout << "Enter 1st number: ";
- cin >> a;
- cout << "Enter 2nd number: ";
- cin >> b;
- cout << "Enter operation: ";
- cin >> operation;
- switch (operation) {
- case '+' :
- cout << a << "+" << b << "=" << a + b;
- break;
- case '-' :
- cout << a << "-" << b << "=" << a - b;
- break;
- case '*' :
- cout << a << "*" << b << "=" << a * b;
- break;
- case '/' :
- cout << a << "/" << b << "=" << a / b;
- break;
- default:
- cout << "Error! There is no such operation!";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment