This repository has been archived on 2024-10-24. You can view files and clone it, but cannot push or open issues or pull requests.
NG_2023_Stanislav_Mykhailenko/Lesson_6/Task_1/Program.cs
Stanislav Mykhailenko 09ec4d3cbd
Add Lesson 6 Task 1
2023-04-12 17:51:12 +03:00

29 lines
No EOL
684 B
C#

using Lesson6.Classes;
namespace Lesson6
{
class Program
{
static void Main(string[] args)
{
Calculator calc = new Calculator();
// subscribe to the event
calc.CalculationPerformed += result => Console.WriteLine($"Result: {result}");
while (true)
{
Console.Write("Enter expression (e.g. 2 + 2) or exit: ");
string? expression = Console.ReadLine();
if (expression == null)
continue;
if (expression == "exit")
break;
calc.Calculate(expression);
}
}
}
}