我最亲爱的说

子非鱼,焉知鱼之乐.

导航

可恶的敲代码!-1

 double dA, dB, dC, dX1, dX2;
            double dD;

            Console.Write("请输入A的值:");
            dA = Convert.ToDouble(Console.ReadLine());
            Console.Write("请输入B的值:");
            dB = Convert.ToDouble(Console.ReadLine());
            Console.Write("请输入C的值:");
            dC = Convert.ToDouble(Console.ReadLine());

            //周长
            dX1 = dA + dB + dC;
            //面积
            double dZ = dX1 / 2;
            dX2 = Math.Sqrt(dZ * (dZ - dA) * (dZ - dB) * (dZ - dC));
            
            //角度
            dD = Math.Acos((dC * dC + dB * dB - dA * dA) / (2 * dC * dB)) * 180 / 3.1415926;
            Console.WriteLine("a角度" + dD);
            dD = Math.Acos((dA * dA + dC * dC - dB * dB) / (2 * dC * dA)) * 180 / 3.1415926;
            Console.WriteLine("b角度" + dD);
            dD = Math.Acos((dA * dA + dB * dB - dC * dC) / (2 * dA * dB)) * 180 / 3.1415926;
            Console.WriteLine("c角度" + dD);

            Console.WriteLine("周长:" + dX1);
            Console.WriteLine("面积: " + dX2);
            Console.ReadKey();

 

posted on 2013-02-28 10:00  我最亲爱的说  阅读(187)  评论(0编辑  收藏  举报