예제 #1
0
파일: Program.cs 프로젝트: LunaraIsk/Task1
        static public Point[] Input() //читаем данные из файла
        {
            using (StreamReader fileIn = new StreamReader("input.txt"))
            {
                int     n  = int.Parse(fileIn.ReadLine());
                Point[] ar = new Point[n];
                for (int i = 0; i < n; i++)
                {
                    string[] text = fileIn.ReadLine().Split(' ');
                    if (text.Length == 2)
                    {
                        ar[i] = new PointPlane(double.Parse(text[0]), double.Parse(text[1]));
                    }
                    else
                    {
                        if (text.Length == 3)
                        {
                            ar[i] = new PointSpace(double.Parse(text[0]), double.Parse(text[1]), double.Parse(text[2]));
                        }

                        else
                        {
                            if (text.Length == 6)
                            {
                                ar[i] = new Segment(double.Parse(text[0]), double.Parse(text[1]), double.Parse(text[2]),
                                                    double.Parse(text[3]), double.Parse(text[4]), double.Parse(text[5]));
                            }
                            else
                            {
                                ar[i] = new Pyramid(double.Parse(text[0]), double.Parse(text[1]), double.Parse(text[2]),
                                                    double.Parse(text[3]), double.Parse(text[4]), double.Parse(text[5]), double.Parse(text[6]),
                                                    double.Parse(text[7]), double.Parse(text[8]), double.Parse(text[9]), double.Parse(text[10]),
                                                    double.Parse(text[11]), double.Parse(text[12]), double.Parse(text[13]), double.Parse(text[14]));
                            }
                        }
                    }
                }
                return(ar);
            }
        }
예제 #2
0
 public Segment(double x1, double y1, double z1, double x2, double y2, double z2)
 {
     begin = new PointSpace(x1, y1, z1);
     end   = new PointSpace(x2, y2, z2);
 }