INPUT:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication20
{
class Program
{
static void Main(string[] args)
{
char option;
string find;
string[,] phone_book = new string[5, 2];
for (int i = 0; i <= 4; i++)
{
for (int j = 0; j <= 1; j++)
{
if (i == 0 && j == 0)
{
phone_book[i, j] = "Name";
}
else if (i == 0)
{
phone_book[i, j] = "Contact";
}
else if (j == 0)
{
Console.WriteLine("plz enter
the {0} Contact Name", i);
phone_book[i, j] = Console.ReadLine();
}
else if (j == 1)
{
Console.WriteLine("plz enter the
Contact Number of {0}",
phone_book[i,0]);
phone_book[i, j] = Console.ReadLine();
}
}
}
do
{
Console.WriteLine("plz enter
the contact number or name to dial");
find = Console.ReadLine();
for (int i = 0; i <= 4; i++)
{
for (int j = 0; j <= 1; j++)
{
if (find == phone_book[i, j])
{
Console.WriteLine(" Name {0}
Number {1} ", phone_book[i, 0],
phone_book[i, 1]);
}
}
}
Console.WriteLine("preess y for
search again");
option = Convert.ToChar(Console.ReadLine());
}
while (option != 'n');
}
}
}
No comments:
Post a Comment