Advertisement
Montagne94

24. Толковый словарь

Oct 14th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.45 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace ConsoleApp1
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             string word = " ";
  11.  
  12.             while (word != "Exit")
  13.             {
  14.                 Console.WriteLine("Введите слово");
  15.                 word = Console.ReadLine();
  16.                 Console.Clear();
  17.                 Console.WriteLine($"{word} - {word = ValueSearch(word)}");
  18.  
  19.                 Console.ReadKey();
  20.                 Console.Clear();
  21.             }
  22.         }
  23.  
  24.         static string ValueSearch(string word)
  25.         {
  26.             Dictionary<string, string> wordList = new Dictionary<string, string>();
  27.             wordList.Add("Программирование", "Вид деятельности, необходимый для организации решения различных задач на ЭВМ.");
  28.             wordList.Add("ЭВМ", "Электронная вычислительная машина.");
  29.             wordList.Add("ПК", "Персональный компьютер");
  30.             wordList.Add("HDD", "Жёсткий диск, винчестер");
  31.  
  32.             if(wordList.ContainsKey(word))
  33.             {
  34.                 word = wordList[word];
  35.             }
  36.             else
  37.             {
  38.                 word = "Данное слово не найдено в словаре";
  39.             }
  40.             return word;
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement