fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. double a, b;
  6. char op;
  7. cin >> a >> op >> b;
  8.  
  9. if (op == '+')
  10. cout << a + b;
  11. else if (op == '-')
  12. cout << a - b;
  13. else if (op == '*')
  14. cout << a * b;
  15. else if (op == '/')
  16. cout << a / b;
  17. else
  18. cout << "error";
  19.  
  20. return 0;
  21. }
  22.  
  23.  
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
error