Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. // Shelton Willis
  2. // CS 1336.010
  3. // Lab 25
  4. #include <iostream>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.  
  11. char op;
  12. float num1;
  13. float num2;
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20. cin >> num1;
  21. cin >> num2;
  22.  
  23. cin >> op;
  24.  
  25.  
  26.  
  27. switch(op)
  28. {
  29. case '+' :
  30. cout << num1 << " " << op << " " << num2 << " = " << num1+num2;
  31. break;
  32.  
  33. case '-':
  34. cout << num1 << " " << op << " " << num2 << " = " << num1-num2;
  35. break;
  36.  
  37. case 'X':
  38. case 'x':
  39. case '*':
  40. cout << num1 << " " << op << " " << num2 << " = " << num1*num2;
  41. break;
  42.  
  43. case '/':
  44. cout << num1 << " " << op << " " << num2 << " = " << num1/num2;
  45.  
  46. break;
  47.  
  48.  
  49. }
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56. return 0;
  57.  
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement