fork download
  1. #include <iostream>
  2.  
  3.  
  4. int main()
  5. {
  6.  
  7.  
  8.  
  9. int n1;
  10. int n2;
  11.  
  12. std::cout << "please enter first number\n";
  13.  
  14. std::cin >> n1;
  15.  
  16. std::cout << "please enter second number\n";
  17.  
  18. std::cin >> n2;
  19.  
  20. std::cout << "what would you like to do. +, -, /, *,\n";
  21.  
  22. char ad = '+';
  23. char sub = '-';
  24. char mul = '*';
  25. char div = '/';
  26.  
  27. std::cin >> ad;
  28. std::cin >> sub;
  29. std::cin >> mul;
  30. std::cin >> div;
  31.  
  32. if ('+') {
  33.  
  34. std::cout << n1 << " + " << n2 << " is " << n1 + n2;
  35. }
  36. else if ('-') {
  37.  
  38. std::cout << n1 << " - " << n2 << " is " << n1 - n2;
  39.  
  40. }
  41. else if ('*') {
  42.  
  43. std::cout << n1 << " * " << n2 << " is " << n1 * n2;
  44. }
  45. else if ('/') {
  46.  
  47. std::cout << n1 << " / " << n2 << " is " << n1 / n2;
  48.  
  49.  
  50. }else {
  51. std::cout << "does not compute\n";
  52. }
  53.  
  54. }
  55.  
  56. int main();
Success #stdin #stdout 0s 4372KB
stdin
Standard input is empty
stdout
please enter first number
please enter second number
what would you like to do. +, -, /, *,
492935216 + 32767 is 492967983