-
Notifications
You must be signed in to change notification settings - Fork 0
/
Calculator.h
40 lines (34 loc) · 1.5 KB
/
Calculator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef CALCULATOR_H
#define CALCULATOR_H
#include<cctype>
#include<conio.h>
#include<memory>
#include"Expression.h"
#include"ExpressionErrorController.h"
#include"DivideByZeroException.h"
#include"NegativeValueInLogarithmicFunctionException.h"
#include"NegativeValueInSquareRootFunctionException.h"
using std::stof;
using std::to_string;
using std::pair;
/*_declspec(dllexport)*/ class Calculator
{
public:
explicit Calculator(const string&);
~Calculator();
/*_declspec(dllexport)*/ const string& calculate();
private:
void factorial(double,stack<long double>&);
const string& result_front_view(double, string&);
const string& optimaze_front_view_result(string&);
double calculate_postfix_expression(); // âû÷èñëåíèå ïîñòôèêñíîé íîòàöèè
void calculation_inside_stack(stack<long double>&, const char*); //âû÷èñëåíèÿ òåêóùåé îïåðàöèè íà ñòåêå
void operation(double&, double&, stack<long double>&);// èçâëå÷åíèå îïåðàíäîâ èç ñòåêà ïåðåä âû÷èñëåíèåì
void operation(double&, stack<long double>&);
bool is_constant(char,stack<long double>&);// ÿâëÿåòñÿ ëè êîíñòàíòîé äàííûé ñèìâîë( êîíñòàíò äâå: ÷èñëî Åéëåðà è ÷èñëî Ïè);
double math_function(const string&,double); // âû÷èñëåíèå ðåçóëüòàòà ìàòåìàòè÷åññêîé ôóíêöèè
void calculate_in_math_functions(stack<stack<long double>>&, stack<string>&,const char*); // âû÷èñëåíèå ìàòåìàòè÷åñêîãî âûðàæåíèÿ (ÿâëÿåòñÿ ÷àñòüþ ìåòîäà calculate_postfix_expression)
std::unique_ptr<Expression> calc_expression;
string result;
};
#endif // !CALCULATOR_H