Last active
April 22, 2025 16:35
-
-
Save Strelok78/6f8e1faf7139f14abd48ca3e6e69e39e to your computer and use it in GitHub Desktop.
Vocabulary
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Collections; | |
| using System.Diagnostics; | |
| namespace iJuniorPractice; | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| const string ExitCommand = "Выход"; | |
| bool isWork = true; | |
| Dictionary<string, string> vocabulary = new Dictionary<string, string>() | |
| { | |
| {"Искра", "маленькая светящаяся частица, возникающая при горении или трении."}, | |
| {"Горизонт","линия, где небо кажется соприкасающимся с землёй."}, | |
| {"Эхо","отражение звука, слышимое как повторение."}, | |
| {"Маяк","сооружение, излучающее свет для навигации судов."}, | |
| {"Туман","густое облако водяных капель, снижающее видимость."} | |
| }; | |
| while (isWork) | |
| { | |
| Console.WriteLine("Содержание словаря"); | |
| foreach (var word in vocabulary) | |
| { | |
| Console.WriteLine(word.Key); | |
| } | |
| Console.WriteLine("Введите интересующее Вас слово"); | |
| Console.WriteLine("Для выхода введите \"{0}\"", ExitCommand); | |
| string inputWord = Console.ReadLine(); | |
| switch (inputWord) | |
| { | |
| case ExitCommand: | |
| Console.WriteLine("До свидания!"); | |
| isWork = false; | |
| break; | |
| default: | |
| Console.WriteLine(GetVocabularyByWord(inputWord, vocabulary)); | |
| break; | |
| } | |
| Console.WriteLine("Нажмите любую клавишу, чтобы продолжить..."); | |
| Console.ReadKey(); | |
| Console.Clear(); | |
| } | |
| } | |
| static string GetVocabularyByWord(string input, Dictionary<string, string> vocabulary) | |
| { | |
| if (vocabulary.ContainsKey(input)) | |
| { | |
| return vocabulary[input]; | |
| } | |
| else | |
| { | |
| return "Слово не найдено в словаре"; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment