Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. void main()
  4. {
  5. int a,b;
  6. char c;
  7. cout << "enter the two numbers to calculate" << endl; cin>>a>>b;
  8.  
  9. cout << " Press the desired operator , + for addition, - for substraction, * for multiplication, / for division " << endl; cin>>c;
  10.  
  11. switch (c)
  12. {
  13. case '+' :
  14. {cout << "the addition result between the two are == " << a+b << endl;};break;
  15. case '-' :
  16. {cout << "the subtraction result between the two are == " << a-b << endl;};break;
  17. case '*' :
  18. {cout << "the multiplication result between the two are == " << a*b << endl;};break;
  19. case '/' :
  20. {cout << "the division result between the two are == " << a/b << endl;};break;
  21. default : cout << "invalid input, thats not a mathematical operator" << endl;
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement