예제 #1
0
 static void Main(string[] args)
 {
     Console.WriteLine("Введите размер массива");
     int size = Convert.ToInt32(Console.ReadLine());
     OdnMas mas = new OdnMas(size);
     tochka tchk;
     char otvet;
     int index;
     while (true)
     {
         menu();
         otvet = Convert.ToChar(Console.ReadLine());
         switch (otvet)
         {
             case '1':
                 Console.WriteLine("Введите индекс:");
                 index = Convert.ToInt32(Console.ReadLine()) - 1;
                 tchk = new tochka(1);
                 mas[index] = tchk;
                 break;
             case '2':
                 Console.WriteLine("Введите индекс:");
                 index = Convert.ToInt32(Console.ReadLine()) - 1;
                 tchk = new tochka(1);
                 mas[index] = tchk;
                 break;
             case '3':
                 Console.WriteLine("Введите индекс:");
                 index = Convert.ToInt32(Console.ReadLine()) - 1;
                 if (mas[index] != null)
                 { Console.WriteLine("x=" + mas[index].X + "\ty=" + mas[index].Y + "\tz=" + mas[index].Z); }
                 break;
             default: return;
         }
     }
 }
예제 #2
0
 public OdnMas(int ch)
 {
     size = ch; massive = new tochka[size];
     for (int i = 0; i < massive.Length; i++) { massive[i] = new tochka(); }
 }