Esempio n. 1
0
 public static void keyInitializer(RangeOfArray rof)
 {
     int key = rof.Down;
     for (int i = 0; i < rof.associativeArray.Length; ++i)
     {
         rof.associativeArray[i].Key = key++;
     }
 }
Esempio n. 2
0
            public static void keyInitializer(RangeOfArray rof)
            {
                int key = rof.Down;

                for (int i = 0; i < rof.associativeArray.Length; ++i)
                {
                    rof.associativeArray[i].Key = key++;
                }
            }
Esempio n. 3
0
        static void Main(string[] args)
        {
            var intCollection = new RangeOfArray <int>();

            for (int i = 0; i < 999; i++)
            {
                intCollection[0]  = Convert.ToInt32(Console.ReadLine());
                intCollection[0] *= 2;
                Console.WriteLine(intCollection[0]);
            }
        }
Esempio n. 4
0
        public void SetArrValue_SetValue_GetTheSameValue2()
        {
            var arr = new RangeOfArray(-9, 15);

            arr[-9] = 100;
            if (arr[-9] == 100)
            {
                Assert.Pass();
                return;
            }
            Assert.Fail();
        }
Esempio n. 5
0
 public static void valueInitalizer(RangeOfArray roa)
 {
     for (int i = 0; i < roa.associativeArray.Length; ++i)
     {
         try
         {
             string val = Console.ReadLine();
             roa.associativeArray[i].Value = Convert.ToInt32(val);
         }
         catch (FormatException ex)
         {
             Console.WriteLine("Введено неверное значение для инициализации");
         }
     }
 }
Esempio n. 6
0
 public static void valueInitalizer(RangeOfArray roa)
 {
     for (int i = 0; i < roa.associativeArray.Length; ++i)
     {
         try
         {
             string val = Console.ReadLine();
             roa.associativeArray[i].Value = Convert.ToInt32(val);
         }
         catch (FormatException ex)
         {
             Console.WriteLine("Введено неверное значение для инициализации");
         }
     }
 }
Esempio n. 7
0
 static void Main(string[] args)
 {
     try
     {
         Console.WriteLine("Введите нижний индекс");
         string strDown = Console.ReadLine();
         Console.WriteLine("Введите верхний индекс");
         string       strUp = Console.ReadLine();
         RangeOfArray rof   = new RangeOfArray(Convert.ToInt32(strDown), Convert.ToInt32(strUp));
         RangeOfArray.keyInitializer(rof);
         Console.WriteLine("Проинициализируйте массив");
         RangeOfArray.valueInitalizer(rof);
         Console.WriteLine("Результирующий массив");
         for (int i = rof.Down; i <= rof.Up; ++i)
         {
             Console.WriteLine("Key: {0,2} Value {1,2}", i, rof[i]);
         }
     }
     catch (FormatException ex)
     {
         Console.WriteLine("Неверно введена верхняя/нижняя граница массива");
     }
 }
Esempio n. 8
0
        static void Main(string[] args)
        {
            try
            {
                Console.WriteLine("Введите нижний индекс");
                string strDown = Console.ReadLine();
                Console.WriteLine("Введите верхний индекс");
                string strUp = Console.ReadLine();
                RangeOfArray rof = new RangeOfArray(Convert.ToInt32(strDown), Convert.ToInt32(strUp));
                RangeOfArray.keyInitializer(rof);
                Console.WriteLine("Проинициализируйте массив");
                RangeOfArray.valueInitalizer(rof);
                Console.WriteLine("Результирующий массив");
                for (int i = rof.Down; i <= rof.Up; ++i)
                {
                    Console.WriteLine("Key: {0,2} Value {1,2}", i, rof[i]);
                }

            }
            catch (FormatException ex)
            {
                Console.WriteLine("Неверно введена верхняя/нижняя граница массива");
            }
        }
Esempio n. 9
0
 public void SetArrValue_ArgumentLowerThenMinIndex_ThrowsArgumentOutOfRangeException()
 {
     var arr = new RangeOfArray(-9, 15);
     var ex  = Assert.Catch <Exception>(() => arr[-10] = 100);
 }
Esempio n. 10
0
        public void SetArrValue_ArgumentIsMaxIndex_NoException()
        {
            var arr = new RangeOfArray(-9, 15);

            Assert.DoesNotThrow(() => arr[15] = 100);
        }