Advertisement
GPbl3YH

CSLight #24

Jan 28th, 2021
520
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.95 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace CSLight
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Dictionary<string, string> dictionary = new Dictionary<string, string>()
  14.             {
  15.                 ["школа"] = "ученики",
  16.                 ["вуз"] = "студенты",
  17.                 ["работа"] = "рабы"
  18.             };
  19.             Console.WriteLine("Введите слово:");
  20.             string userInput = Console.ReadLine().ToLower();
  21.             if(dictionary.ContainsKey(userInput))
  22.             {
  23.                 Console.WriteLine($"\n{dictionary[userInput]}");
  24.             }
  25.             else
  26.             {
  27.                 Console.WriteLine("Значение по этому ключу не было найдено.");
  28.             }
  29.             Console.ReadKey();
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement