fork download
  1. #include <iostream>
  2. using namespace std;
  3. int main () {
  4. char op;
  5. float a, b;
  6. cin >> a >> b;
  7. cin >> op;
  8. if (op == '+')
  9. cout << "sum" << a + b << endl;
  10. if (op == '-')
  11. cout << "diff" << a - b << endl;
  12. if (op == '*')
  13. cout << "prod" << a * b << endl;
  14. if (op == '/')
  15. cout << "divide" << a / b << endl;
  16. return 0;
  17. }
Success #stdin #stdout 0s 5324KB
stdin
10 5 /
stdout
divide2