Advertisement
Guest User

phonebook

a guest
Jun 22nd, 2017
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.37 KB | None | 0 0
  1. using System;
  2.  
  3. namespace phoneBook
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.  
  10.             string[] phoneNumbers = Console.ReadLine().Split(' ');
  11.             string[] names = Console.ReadLine().Split(' ');
  12.             string[] ownNames = new string[names.Length];
  13.             var index = 0;
  14.             int[] indexInNames = new int[names.Length];
  15.             var run = true;
  16.             while (run)
  17.             {
  18.                 var input = Console.ReadLine();
  19.                 if (input == "done")
  20.                 {
  21.                     break;//run = false;
  22.                 }
  23.                 for (int i = 0; i < names.Length; i++)
  24.                 {
  25.                     //for (int y = 0; y < ownNames.Length; y++)
  26.                     //{
  27.                         if (names[i] == input/*ownNames[y]*/)
  28.                         {
  29.                             index = i; break;
  30.                         }
  31.                     //}
  32.                 }
  33.                 //for (int i = 0; i < indexInNames.Length; i++)
  34.                 //{
  35.                     //if (indexInNames[i] != null)
  36.                     //{
  37.                         Console.WriteLine(names[index] + " -> " + phoneNumbers[index]);
  38.                     //}
  39.                 //}
  40.                 //ownNames[index] = input;
  41.                 //index++;
  42.             }
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement