Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace C_sharp_Light
- {
- class Program
- {
- static void Main(string[] args)
- {
- bool isOpen = true;
- while (isOpen)
- {
- Console.WriteLine("Я все ещё работаю");
- Console.WriteLine("Варианты команд:\n" +
- "exit - выход\n" +
- "Hello World - вывод Hellow World\n" +
- "Plus - сложить два числа");
- switch (Console.ReadLine())
- {
- case "exit":
- isOpen = false;
- break;
- case "Hello World":
- Console.WriteLine("Hellow World!");
- break;
- case "Plus":
- Console.Write("Введите первое число - ");
- int x = Convert.ToInt32(Console.ReadLine());
- Console.Write("Введите второе число - ");
- int y = Convert.ToInt32(Console.ReadLine());
- int result = x + y;
- Console.WriteLine($"{x}+{y}={result}");
- break;
- }
- if (isOpen) // Если не будет проверки, то при выходе надо будет дополнительный раз нажимать энтер.
- {
- Console.ReadKey();
- Console.Clear();
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement