public static double TinhChuViTamGiac(TAMGIAC tg)
        {
            double bc, ac, ab;

            bc = XL_DIEM.TinhKhoangCach(tg.B, tg.C);
            ac = XL_DIEM.TinhKhoangCach(tg.A, tg.C);
            ab = XL_DIEM.TinhKhoangCach(tg.A, tg.B);

            return(bc + ac + ab);
        }
        public static double TinhChuViDaGiac(DAGIAC dg)
        {
            double ChuVi = 0;
            int    N     = dg.dsDIEM.Length;

            for (int i = 0; i < N - 1; i++)
            {
                ChuVi = ChuVi + XL_DIEM.TinhKhoangCach(dg.dsDIEM[i],
                                                       dg.dsDIEM[i + 1]);
            }

            ChuVi = ChuVi + XL_DIEM.TinhKhoangCach(dg.dsDIEM[0],
                                                   dg.dsDIEM[N - 1]);
            return(ChuVi);
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            Console.WriteLine("Nhap 2 diem a, b");
            DIEM a, b;

            a = XL_DIEM.NhapDiem();
            b = XL_DIEM.NhapDiem();

            Console.WriteLine("Khoang cach 2 diem la: ");
            double kq = XL_DIEM.TinhKhoangCach(a, b);

            string Chuoi = "Ket qua la " + kq;

            Console.WriteLine(Chuoi);

            Console.WriteLine("Nhap 3 diem A, B, C cua tam giac");
            TAMGIAC tg;

            tg = XL_TAMGIAC.NhapTamGiac();
            double kq_tg = XL_TAMGIAC.TinhChuViTamGiac(tg);

            string Chuoi_tg = "Ket qua la " + kq_tg;

            Console.WriteLine(Chuoi_tg);

            Console.WriteLine("Nhap cac diem cua da giac");
            DAGIAC dg;

            dg = XL_DAGIAC.NhapDaGiac();

            Console.Write("Chu vi da giac la: ");
            double kq_dg = XL_DAGIAC.TinhChuViDaGiac(dg);

            Console.WriteLine(kq_dg);
        }