Advertisement
Guest User

Untitled

a guest
Sep 21st, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3. #include <iomanip>
  4.  
  5. using namespace std;
  6. int main()
  7. {
  8. int num1, num2;
  9. char opr;
  10. cout << "I want you to put two integers, GO WILD!! ^_^: ALL RIGHTS RESERVERD @ JUNZYSTARZ 8):";
  11. cin >> num1 >> num2;
  12. cout << endl;
  13. cout << "Enter operator symbol: + (ADD), - (SUBTRACT)," << " * (MULTIPLY), / (DIVIDE): ";
  14. cin >> opr;
  15. cout << endl;
  16. cout << num1 << " " << opr << " " << num2 << " = ";
  17. switch (opr) {
  18. case '+':
  19. cout << num1 + num2 << endl;
  20. break;
  21. case'-':
  22. cout << num1 - num2 << endl;
  23. break;
  24. case'*':
  25. cout << num1 * num2 << endl;
  26. break;
  27. case'/':
  28. if (num2 != 0)
  29. cout << num1 / num2 << endl;
  30. else
  31. cout << "ERROR \nCannot divide by zero" << endl;
  32. break;
  33. default:
  34. cout << "Illegal operation" << endl;
  35. }
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement