Тема: Вивід даних на консоль
Всім привіт. Є одна задача -вивести прізвища абонентів, номери телефонів яких починаються на задані цифри. Тобто я ввожу телефон. Потім при запиті треба ввести тільки початок телефону. І вивести список з цим початком телефону.Хто знає - допоможіть!!!!
using System;
using System.IO;
namespace Praktika
{
    class Program
    {
        public struct Abonentu
        {
            public string sename;
            public uint number;
            public string adress;
            public uint vudOplatu;
            public uint vartist;
        }
        static void Main(string[] args)
        {
            FileInfo fi = new FileInfo("text.txt");
            StreamWriter sw;
            FileInfo fi1 = new FileInfo("text1.txt");
            StreamWriter sw1;
            if (fi.Exists)
            {
                sw = fi.AppendText();
            }
            else
            {
                sw = fi.CreateText();
                sw.WriteLine("Abonentu".PadRight(30, '-'));
            }
            Console.WriteLine("Vvedit kilkist elementiv masuvy");
            int kilkist = Convert.ToInt32(Console.ReadLine());
            Console.Clear();
            Abonentu[] ab = new Abonentu[kilkist];
            for (int i = 0; i < kilkist; i++)
            {
                ab[i] = new Abonentu();
                Console.WriteLine("Vvedit prizvushche");
                ab[i].sename = Convert.ToString(Console.ReadLine());
                Console.WriteLine("Vvedit nomer");
                ab[i].number = Convert.ToUInt32(Console.ReadLine());
                Console.WriteLine("Vvedit adresu (index, misto, vyluca, bydunok)");
                ab[i].adress = Convert.ToString(Console.ReadLine());
                Console.WriteLine("Vvedit vud oplatu");
                Console.WriteLine("1 - shcohvulunna");
                Console.WriteLine("2 - abonementna");
                ab[i].vudOplatu = Convert.ToUInt32(Console.ReadLine());
                Console.WriteLine("Vvedit vartist oplatu");
                ab[i].vartist = Convert.ToUInt32(Console.ReadLine());
            }
            Console.Clear();
            Console.WriteLine("Abonentu".PadRight(30, '-'));
            foreach (Abonentu abonentu in ab)
            {
                Console.WriteLine("{0} {1} {2} {3} {4}", abonentu.sename, abonentu.number, abonentu.adress, abonentu.vudOplatu, abonentu.vartist);
                sw.WriteLine("{0} {1} {2} {3} {4}", abonentu.sename, abonentu.number, abonentu.adress, abonentu.vudOplatu, abonentu.vartist);
            }
            Console.ReadLine();
            sw.Close();
            Console.Clear();
            if (fi1.Exists)
            {
                sw1 = fi1.AppendText();
            }
            else
            {
                sw1 = fi1.CreateText();
                sw1.WriteLine("Abonentu".PadRight(30, '-'));
            }
            Console.WriteLine("Vvedit pochatok telefony");
            int num = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Abonentu z takum pochatkom nomera - {0}", num);
            foreach(Abonentu abonentu in ab)
            {
                if (abonentu.number == num)
                {
                    Console.WriteLine("{0} {1}", abonentu.number, abonentu.sename);
                    sw1.WriteLine("{0} {1}", abonentu.number, abonentu.sename);
                }
            }
            sw1.Close();
            Console.ReadLine();
            Console.Clear();
        }
    }
}