Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Threading;
- using System.Collections.Generic;
- using static System.Math;
- using System.Text;
- namespace homework
- {
- class Program
- {
- static void Main(string[] args)
- {
- bool isContinue = true;
- Dictionary<string,string> dict = new Dictionary<string, string>();
- dict.Add("Яблоко","сочный плод, который употребляется в пищу в свежем виде" );
- dict.Add("Стол","предмет обихода, мебельное изделие");
- while(isContinue)
- {
- WriteColoredText("команда для выхода из программы: exit\nВведите слово или команду: ");
- string userInput = Console.ReadLine();
- if(dict.ContainsKey(userInput))
- {
- Console.WriteLine(dict[userInput]);
- }
- else if(userInput == "exit")
- {
- isContinue = false;
- }
- else
- {
- WriteColoredText("Такого значения в словаре нету\n", ConsoleColor.Red);
- }
- }
- }
- private static void WriteColoredText(string text, ConsoleColor color = ConsoleColor.Yellow)
- {
- Console.ForegroundColor = color;
- Console.Write(text);
- Console.ResetColor();
- }
- }
- }
Add Comment
Please, Sign In to add comment