Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. using namespace std;
  4.  
  5.  
  6. int main()
  7. {
  8.  
  9. int num1;
  10. int num2;
  11. int ans;
  12. char command;
  13.  
  14.  
  15. cout << "Calc v[0.1]" << endl;
  16. cout << "Enter Your Calculations :";
  17. cin >> num1 >> command >> num2;
  18.  
  19. if(command == '*') {
  20. ans = num1 * num2;
  21. }
  22.  
  23. if(command == '/') {
  24. ans = num1 / num2;
  25. }
  26.  
  27. if(command == '+') {
  28. ans = num1 + num2;
  29. }
  30.  
  31. if(command == '-') {
  32. ans = num1 - num2;
  33. }
  34.  
  35. cout << ans << endl;
  36.  
  37. system("PAUSE");
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement