Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- namespace Homework13
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- const string ListenMelody = "1";
- const string CompositionNumbers = "2";
- const string ChangeTextColor = "3";
- const string CommandExit = "exit";
- Console.WriteLine("Вы попали в меню выбора команд.");
- string desireOperation = Console.ReadLine();
- while (desireOperation != CommandExit)
- {
- Console.WriteLine("Введите действие из предложенных:");
- Console.WriteLine($"{ListenMelody} - прослушать мелодию.");
- Console.WriteLine($"{CompositionNumbers} - узнать произведение двух чисел.");
- Console.WriteLine($"{ChangeTextColor} - изменить цвет введенного текста.");
- Console.WriteLine($"{CommandExit} - для выхода из программы.");
- Console.WriteLine("Ваш выбор: ");
- desireOperation = Console.ReadLine();
- Console.Clear();
- switch (desireOperation)
- {
- case ListenMelody:
- Console.Beep(264, 125);
- Thread.Sleep(250);
- Console.Beep(264, 125);
- Thread.Sleep(125);
- Console.Beep(297, 500);
- Thread.Sleep(125);
- Console.Beep(264, 500);
- Thread.Sleep(125);
- Console.Beep(352, 500);
- Thread.Sleep(125);
- Console.Beep(330, 1000);
- Thread.Sleep(250);
- Console.Beep(264, 125);
- Thread.Sleep(250);
- Console.Beep(264, 125);
- Thread.Sleep(125);
- Console.Beep(297, 500);
- Thread.Sleep(125);
- Console.Beep(264, 500);
- Thread.Sleep(125);
- Console.Beep(396, 500);
- Thread.Sleep(125);
- Console.Beep(352, 1000);
- Thread.Sleep(250);
- break;
- case CompositionNumbers:
- float firstNumber, secondNumber;
- Console.WriteLine($"Введите первое число");
- firstNumber = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine($"Введите второе число");
- secondNumber = Convert.ToInt32(Console.ReadLine());
- float compositionNumbers = firstNumber * secondNumber;
- Console.WriteLine($"Результат произведения этих чисел равен - {compositionNumbers}");
- break;
- case ChangeTextColor:
- Console.WriteLine("Ведите текст цвет которого хотите изменить");
- string userInput = Console.ReadLine();
- Console.ForegroundColor = ConsoleColor.Red;
- Console.Clear();
- Console.WriteLine(userInput);
- Console.ReadKey();
- Console.ResetColor();
- Console.Clear();
- break;
- case CommandExit:
- Console.WriteLine("Вы вышли из программы");
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement