Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace CSLightFirst
- {
- class Program
- {
- private static void Main()
- {
- bool isExit = false;
- while (!isExit)
- {
- Console.WriteLine("Что бы Вы хотели сделать?\ndate - Показать текущую дату\ntime - Показать текущее время\nexit - Выйти из программы\n");
- Console.Write("Ваш ответ: ");
- string userInput = Console.ReadLine();
- Console.WriteLine();
- switch (userInput)
- {
- case "date":
- Console.WriteLine($"Текущая дата: {DateTime.Today.Date}");
- break;
- case "time":
- Console.WriteLine($"Текущее время: {DateTime.Now.TimeOfDay}");
- break;
- case "exit":
- isExit = true;
- break;
- }
- Console.WriteLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement