-
-
Save StrikerXx798/b2a7d31c8045b9b5fc2c68abb8644936 to your computer and use it in GitHub Desktop.
ДЗ: Толковый словарь
This file contains 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; | |
using System.Collections.Generic; | |
using System.Text; | |
namespace ConsoleApp1 | |
{ | |
internal class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.InputEncoding = Encoding.Unicode; | |
Console.OutputEncoding = Encoding.Unicode; | |
Dictionary<string, string> dictionary = new Dictionary<string, string> | |
{ | |
{ "яблоко", "Фрукт, который растёт на дереве" }, | |
{ "компьютер", "Электронное устройство для обработки данных" }, | |
{ "книга", "Печатное или электронное издание с текстом" } | |
}; | |
Console.WriteLine("Введите слово:"); | |
string input = Console.ReadLine(); | |
if (dictionary.TryGetValue(input, out string value)) | |
{ | |
Console.WriteLine($"Значение слова '{input}': {value}"); | |
} | |
else | |
{ | |
Console.WriteLine($"Слово '{input}' отсутствует в словаре."); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment