예제 #1
0
        public static double TinhChuViTamGiac(TamGiac t)
        {
            double res = -1;

            if (t.TamGiacHopLe())
            {
                res = t.lineA + t.lineB + t.lineC;
            }
            return(res);
        }
예제 #2
0
        public static double TinhDienTichTamGiac2(TamGiac t)
        {
            double res = 1;

            if (t.TamGiacHopLe())
            {
                return(Math.Abs((t.PointC.x - t.PointA.x) * (t.PointB.y - t.PointA.y)
                                - (t.PointB.x - t.PointA.x) * (t.PointC.y - t.PointA.y)) / 2);
            }
            return(res);
        }
예제 #3
0
        public static double TinhDienTichTamGiac(TamGiac t)
        {
            double res = 1;

            if (t.TamGiacHopLe())
            {
                double p = (t.lineA + t.lineB + t.lineC) / 2;
                res = Math.Sqrt(p * (p - t.lineA) * (p - t.lineB) * (p - t.lineC));
            }
            return(res);
        }
예제 #4
0
        public static TamGiac NhapTamGiac()
        {
            TamGiac t = new TamGiac();

            Console.WriteLine("Nhap dinh A");
            t.PointA = NhapDiem();
            Console.WriteLine("Nhap dinh B");
            t.PointB = NhapDiem();
            Console.WriteLine("Nhap dinh C");
            t.PointC = NhapDiem();
            return(t);
        }