Advertisement
Guest User

Untitled

a guest
Sep 13th, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. main(){
  6. double num1, num2;
  7. char symbol;
  8.  
  9. cout << "Enter first number: " << endl;
  10. cin >> num1;
  11. cout << "Enter symbol (+, -, *, /):" << endl;
  12. cin >> symbol;
  13. cout << "Enter second number: " << endl;
  14. cin >> num2;
  15.  
  16. if(symbol == '+') {
  17. cout << "Result: " << num1+num2;
  18.  
  19. }else
  20. if(symbol == '-') {
  21. cout << "Result: " << num1-num2;
  22. }else
  23. if(symbol == '*') {
  24. cout << "Result: " << num1*num2;
  25. }else
  26. if(symbol == '/') {
  27. cout << "Result:" << num1/num2;
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement