-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
30 lines (25 loc) · 864 Bytes
/
Program.cs
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
namespace reverse_polish_notation;
public class Program
{
static void Main(string[] args)
{
var calculator = new RpnCalculator(true)
{
new Addition(),
new Subtraction(),
new Multiplication(),
new Division(),
new Sqrt(),
new Exponent(),
new Logarithm(),
new Constant("pi", "pi", "constant pi", Math.PI),
new Constant("e", "e", "constant e", Math.E)
};
var parser = new Parser(calculator.SupportedOperators);
var menu = new TextMenu(calculator.OperationsHelpText);
var rpn = new RpnEvaluator(calculator, parser);
var mathjs = new MathJsEvaluator();
var controller = new Controller(new IExpressionEvaluator[]{rpn, mathjs}, menu);
controller.Run();
}
}