kwest87

Untitled

Apr 18th, 2022
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.94 KB | None | 0 0
  1. [StartCode]
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace ConsoleApp16
  9. {
  10.     internal class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             Dictionary<string, string> peoples = new Dictionary<string, string>();
  15.             peoples.Add("Алекс", "23 года");
  16.             peoples.Add("Антон", "22 года");
  17.             peoples.Add("Семён", "32 года");
  18.             peoples.Add("Андрей", "20 лет");
  19.             peoples.Add("Максим", "36 лет");
  20.  
  21.             Showage(peoples);
  22.         }
  23.  
  24.         static void Showage(Dictionary<string,string>peoples)
  25.         {
  26.             if (peoples.ContainsKey(Console.ReadLine()))
  27.                 Console.WriteLine(peoples["Алекс"]);
  28.  
  29.             else
  30.                 Console.WriteLine("Такого нету.");
  31.         }
  32.     }
  33. }
  34. [endCode]
Advertisement
Add Comment
Please, Sign In to add comment