diff --git a/Calculator/Calculator/Program.cs b/Calculator/Calculator/Program.cs index 3751555..5b01d44 100644 --- a/Calculator/Calculator/Program.cs +++ b/Calculator/Calculator/Program.cs @@ -1,2 +1,125 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); +using System; + +namespace Calculator +{ + class Calculator + { + public static void Main(string[] args) + { + + var Cal = new Calculator(); + Cal.Start(); + } + public void Start() + { + while (true) + { + Console.WriteLine("Начало:"); + string a = Console.ReadLine(); + int b = 0; + + switch (a) + { + case "+": + Console.WriteLine("Введите числа:"); + for (int i = 0; i == b;) + { + do + { + try + { + b = Convert.ToInt32(Console.ReadLine()); + i += b; + if (b > 0) + b -= 1; + Console.WriteLine($"Вывод: {i}"); + } + catch + { + Console.WriteLine("Неверный синтаксис!"); + continue; + } + } while (a == "+" && b != 0); + Console.WriteLine("Конец сложения"); + break; + } + break; + case "-": + Console.WriteLine("Введите числа:"); + for (int i = 0; i == b;) + { + do + { + try + { + int c = Convert.ToInt32(Console.ReadLine()); + b = Convert.ToInt32(Console.ReadLine()); + i = c -= b; + if (b > 0) + b -= 1;//нужно исправить вылетает когда 1 пишем + Console.WriteLine($"Вывод: {i}"); + } + catch + { + Console.WriteLine("Неверный синтаксис!"); + continue; + } + + } while (a == "-" && b != 0); + } + Console.WriteLine("Конец вычитания"); + break; + case "*": + Console.WriteLine("Введите числа:"); + b = 1; + for (int i = 1; i == b;) + { + do + { + try + { + b = Convert.ToInt32(Console.ReadLine()); + i *= b; + if (b > 0) + b -= 1; + Console.WriteLine($"Вывод: {i}"); + } + catch + { + Console.WriteLine("Неверный синтаксис!"); + continue; + } + + } while (a == "*" && b != 0); + } + break; + case "/": + float g = 0; + Console.WriteLine("Введите числа:"); + for (float i = 0f; i == g;) + { + do + { + try + { + float c = Convert.ToInt32(Console.ReadLine()); + g = Convert.ToInt32(Console.ReadLine()); + i = c /= g; + if (g > 0f) + g -= 1; + Console.WriteLine($"Вывод: {i}"); + } + catch + { + Console.WriteLine("Неверный синтаксис!"); + continue; + } + + } while (a == "/" && g != 0); + } + break; + } + } + } + } +} \ No newline at end of file diff --git a/Calculator/Calculator/bin/Debug/net8.0/Calculator.deps.json b/Calculator/Calculator/bin/Debug/net8.0/Calculator.deps.json new file mode 100644 index 0000000..0ceff45 --- /dev/null +++ b/Calculator/Calculator/bin/Debug/net8.0/Calculator.deps.json @@ -0,0 +1,23 @@ +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v8.0", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETCoreApp,Version=v8.0": { + "Calculator/1.0.0": { + "runtime": { + "Calculator.dll": {} + } + } + } + }, + "libraries": { + "Calculator/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + } + } +} \ No newline at end of file diff --git a/Calculator/Calculator/bin/Debug/net8.0/Calculator.dll b/Calculator/Calculator/bin/Debug/net8.0/Calculator.dll new file mode 100644 index 0000000..49e1b76 Binary files /dev/null and b/Calculator/Calculator/bin/Debug/net8.0/Calculator.dll differ diff --git a/Calculator/Calculator/bin/Debug/net8.0/Calculator.exe b/Calculator/Calculator/bin/Debug/net8.0/Calculator.exe new file mode 100644 index 0000000..06ed499 Binary files /dev/null and b/Calculator/Calculator/bin/Debug/net8.0/Calculator.exe differ diff --git a/Calculator/Calculator/bin/Debug/net8.0/Calculator.pdb b/Calculator/Calculator/bin/Debug/net8.0/Calculator.pdb new file mode 100644 index 0000000..921552b Binary files /dev/null and b/Calculator/Calculator/bin/Debug/net8.0/Calculator.pdb differ diff --git a/Calculator/Calculator/bin/Debug/net8.0/Calculator.runtimeconfig.json b/Calculator/Calculator/bin/Debug/net8.0/Calculator.runtimeconfig.json new file mode 100644 index 0000000..becfaea --- /dev/null +++ b/Calculator/Calculator/bin/Debug/net8.0/Calculator.runtimeconfig.json @@ -0,0 +1,12 @@ +{ + "runtimeOptions": { + "tfm": "net8.0", + "framework": { + "name": "Microsoft.NETCore.App", + "version": "8.0.0" + }, + "configProperties": { + "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false + } + } +} \ No newline at end of file