Exemple #1
0
        static void Main(string[] args)
        {
            Tablica tab = new Tablica();

            //tab.TableResized += new TableResizedEventHandler(TableResized);
            tab.TableResized += TableResized;

            tab.Add(7);
            tab.Add(-5);
            tab.AddAt(0, -5);
            tab.Add(2);
            tab.AddAt(7, -45);
            tab[9] = -90;
            tab.AddAt(19, -45);
            WriteTable(tab);
            int val, index;

            do
            {
                Console.WriteLine("Podaj index: ");
                index = int.Parse(Console.ReadLine());
                Console.WriteLine("Podaj wartosc: ");
                val = int.Parse(Console.ReadLine());
                if (index != 0 && val != 0)
                {
                    tab[index] = val;
                }
                WriteTableWithoutDefaults(tab);
            } while (index != 0 && val != 0);
            WriteTable(tab);
            Console.ReadKey();
        }
Exemple #2
0
 public static void WriteTable(Tablica tab)
 {
     Console.WriteLine("Size " + tab.Size);
     for (int i = 0; i < tab.Size; i++)
     {
         Console.WriteLine("Index " + i + ": " + tab[i]);
     }
 }
Exemple #3
0
 public static void WriteTableWithoutDefaults(Tablica tab)
 {
     Console.WriteLine("Size " + tab.Size);
     for (int i = 0; i < tab.Size; i++)
     {
         if (tab[i] != -1)
         {
             Console.WriteLine("Index " + i + ": " + tab[i]);
         }
     }
 }