Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- Dictionary<string, string> names = new Dictionary<string, string>();
- names.Add("Петров", "Андрей Максимович");
- names.Add("Алексеев", "Иван Борисович");
- names.Add("Сафронов", "Сергей Игоревич");
- names.Add("Пушкин", "Александр Владимирович");
- names.Add("Рыжов", "Матвей Григорьевич");
- Console.WriteLine("Введите фамилию ученика");
- string userInput = Console.ReadLine();
- if (names.ContainsKey(userInput))
- Console.WriteLine($"ФИО ученика: {userInput} {names[userInput]}");
- else
- Console.WriteLine("Фамилия не найдена");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement