Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include <string>
- using namespace System;
- double a;
- double b;
- double result;
- enum operators
- {
- plus = 1,
- minus = 2,
- multiply = 3,
- division = 4
- };
- String^ inputNum(char n, String^ currentNum)
- {
- return currentNum = currentNum + n;
- }
- String^ conversion(String^ firstNum, String^ secondNum, int operation)
- {
- a = Convert::ToDouble(firstNum);
- b = Convert::ToDouble(secondNum);
- switch (operation)
- {
- case plus:
- {
- result = a + b;
- break;
- }
- case minus:
- {
- result = a - b;
- break;
- }
- case multiply:
- {
- result = a * b;
- break;
- }
- case division:
- {
- result = a / b;
- break;
- }
- default:
- {
- Exception("Operation not found!");
- break;
- }
- }
- return Convert::ToString(result);
- }
- int getOperator(String^ curOper)
- {
- if (curOper == "+")
- return 1;
- if (curOper == "-")
- return 2;
- if (curOper == "*")
- return 3;
- if (curOper == "/")
- return 4;
- return -1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement