Advertisement
YavorGrancharov

Phonebook

Jun 19th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.90 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 Phonebook
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string[] numbers = Console.ReadLine().Split(' ');
  14.  
  15.             string[] names = Console.ReadLine().Split(' ');
  16.  
  17.             string input = Console.ReadLine();
  18.  
  19.             while (input != "done")
  20.             {
  21.                 PrintResult(numbers, names, input);
  22.                 input = Console.ReadLine();
  23.             }
  24.         }
  25.  
  26.         static void PrintResult(string[] numbers, string[] names, string input)
  27.         {
  28.             for (int i = 0; i < names.Length; i++)
  29.             {
  30.                 if (input == names[i])
  31.                 {
  32.                     Console.WriteLine($"{names[i]} -> {numbers[i]}");
  33.                 }
  34.             }
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement