Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main(){
- int num1, num2, result;
- char op;
- cout << "Enter a number --> " << endl;
- cin >> num1;
- cout << "Enter an operator --> " << endl;
- cin >> op;
- cout << "Enter another number --> " << endl;
- cin >> num2;
- if(op=='+')result=num1+num2;
- if(op=='-')result=num1-num2;
- if(op=='*')result=num1*num2;
- if(op=='/')result=num1/num2;
- cout << "Your answer is --> " << result << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement