Advertisement
OwlyOwl

dictionary

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