Advertisement
OwlyOwl

dictionary2

Jun 20th, 2020
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 KB | None | 0 0
  1. public class Program
  2. {
  3.     public static void Main()
  4.     {
  5.         Dictionary<string, string> dictionary = new Dictionary<string, string>();
  6.         dictionary.Add("Привет","Hello");
  7.         dictionary.Add("Пока","Bye");
  8.         dictionary.Add("Да","Yes");
  9.         dictionary.Add("Нет","No");
  10.         Console.WriteLine("Введите слово: ");
  11.         string userInput = Console.ReadLine();
  12.         if (dictionary.ContainsKey(userInput);
  13.         {
  14.          Console.WriteLine("Перевод:" + dictionary["userInput"];
  15.         }
  16.         else
  17.         {
  18.         Console.WriteLine("Данного слова нет в словаре");
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement