Advertisement
Guest User

Untitled

a guest
Feb 16th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6.  
  7. int num1, num2, result;
  8. char op;
  9.  
  10. cout << "Enter a number --> " << endl;
  11. cin >> num1;
  12.  
  13. cout << "Enter an operator --> " << endl;
  14. cin >> op;
  15.  
  16. cout << "Enter another number --> " << endl;
  17. cin >> num2;
  18.  
  19. if(op=='+')result=num1+num2;
  20. if(op=='-')result=num1-num2;
  21. if(op=='*')result=num1*num2;
  22. if(op=='/')result=num1/num2;
  23.  
  24. cout << "Your answer is --> " << result << endl;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement