Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void main()
- {
- int a,b;
- char c;
- cout << "enter the two numbers to calculate" << endl; cin>>a>>b;
- cout << " Press the desired operator , + for addition, - for substraction, * for multiplication, / for division " << endl; cin>>c;
- switch (c)
- {
- case '+' :
- {cout << "the addition result between the two are == " << a+b << endl;};break;
- case '-' :
- {cout << "the subtraction result between the two are == " << a-b << endl;};break;
- case '*' :
- {cout << "the multiplication result between the two are == " << a*b << endl;};break;
- case '/' :
- {cout << "the division result between the two are == " << a/b << endl;};break;
- default : cout << "invalid input, thats not a mathematical operator" << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement