Advertisement
grubcho

Phone book

Jun 20th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 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[] phones = Console.ReadLine().Split(' ');
  14.             string[] names = Console.ReadLine().Split(' ');
  15.             string name = string.Empty;
  16.             while (name != "done")
  17.             {
  18.                 name = Console.ReadLine();
  19.                 for (int i = 0; i < names.Length; i++)
  20.                 {
  21.                     if (names[i] == name)
  22.                     {
  23.                         Console.WriteLine($"{names[i]} -> {phones[i]}");
  24.                     }
  25.                 }
  26.             }
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement