Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include <cstdlib>
- #include <cstring>
- using namespace std;
- int main(int argc, char *argv[] ){
- int a = strtoul(argv[1],NULL,0);
- string op = argv[2];
- int b = strtoul(argv[3],NULL,0);
- int answer = 0;
- if(op == "+"){
- answer = a + b;
- }
- else if(op == "-"){
- answer = a - b;
- }
- else if(op == "*"){
- answer = a * b;
- }
- else if(op == "/"){
- answer = a / b;
- }
- cout << a << " " << op << " " << b << " = " << answer << endl;
- //cout << op << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement