Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include "iostream"
- #include "conio.h"
- using namespace std;
- int StringToInt(const char * str)
- {
- char * pLastChar = NULL;
- int param = strtol(str, &pLastChar, 10);
- return param;
- }
- int main(int argc, char*argv[])
- {
- char symbol = *argv[2];
- if (symbol == '+')
- cout << "a1 + b1 = " << StringToInt(argv[1]) + StringToInt(argv[3]);
- else
- if (symbol == '-')
- cout << "a1 - b1 = " << StringToInt(argv[1]) - StringToInt(argv[3]);
- else
- if (symbol == '*')
- cout << "a1 * b1 = " << StringToInt(argv[1]) * StringToInt(argv[3]);
- else
- cout << "a1 / b1 = " << StringToInt(argv[1]) / StringToInt(argv[3]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement