fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main() {
  6. char select;
  7. int x;
  8. int y;
  9.  
  10. cout << "Select: +,-,*,/: " << endl;
  11. cin >> select;
  12.  
  13.  
  14. if (select == '+') {
  15. cout << "Enter a number: " << endl;
  16. cin >> x;
  17. cout << "Enter a number: " << endl;
  18. cin >> y;
  19. cout << x + y;
  20. }
  21.  
  22. if (select == '-') {
  23. cout << "Enter a number: " << endl;
  24. cin >> x;
  25. cout << "Enter a number: " << endl;
  26. cin >> y;
  27. cout << x - y;
  28. }
  29. if (select == '*') {
  30. cout << "Enter a number: " << endl;
  31. cin >> x;
  32. cout << "Enter a number: " << endl;
  33. cin >> y;
  34. cout << x * y;
  35. }
  36. if (select == '/') {
  37. cout << "Enter a number: " << endl;
  38. cin >> x;
  39. cout << "Enter a number: " << endl;
  40. cin >> y;
  41. cout << x / y;
  42. }
  43.  
  44. return 0;
  45.  
  46.  
  47. }
  48.  
  49.  
  50.  
  51.  
Success #stdin #stdout 0.01s 5320KB
stdin
*
10
10
stdout
Select: +,-,*,/: 
Enter a number: 
Enter a number: 
100