Advertisement
vasilivanov93

Untitled

Apr 13th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _03.Phonebook
  4. {
  5. public class Phonebook
  6. {
  7. public static void Main()
  8. {
  9. string[] phoneNumbers = Console.ReadLine().Split(' ');
  10. string[] names = Console.ReadLine().Split(' ');
  11.  
  12. string inputLine = Console.ReadLine();
  13.  
  14. while (inputLine != "done")
  15. {
  16. PrintElement(phoneNumbers, names, inputLine);
  17. inputLine = Console.ReadLine();
  18. }
  19. }
  20.  
  21. private static void PrintElement(string[] phoneNumbers, string[] names, string inputLine)
  22. {
  23. for (int i = 0; i < names.Length; i++)
  24. {
  25. if (names[i] == inputLine)
  26. {
  27. Console.WriteLine($"{names[i]} -> {phoneNumbers[i]}");
  28. }
  29. }
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement