Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Homework33
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- bool isWork = true;
- string exitProgram = "exit";
- int positionInputX = 0;
- int positionInputY = 5;
- Dictionary<string, string> wordbook = new Dictionary<string, string>();
- wordbook.Add("bread", "food");
- wordbook.Add("pistol", "peapon");
- wordbook.Add("pills", "drug");
- while (isWork)
- {
- Console.WriteLine($"Введите слово из списка чтобы узнать его значение.");
- foreach (string word in wordbook.Keys)
- {
- Console.WriteLine(word);
- }
- Console.SetCursorPosition(positionInputX, positionInputY);
- string userInput = Console.ReadLine();
- if (userInput == exitProgram)
- {
- isWork = false;
- Console.WriteLine("Вы вышли из программы!");
- }
- else if (wordbook.ContainsKey(userInput))
- {
- Console.WriteLine($"Значение введенного слова : {wordbook[userInput]}");
- }
- else
- {
- Console.WriteLine("Такого слова нет в словаре");
- }
- Console.ReadKey();
- Console.Clear();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement