예제 #1
0
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         double a, b, c;
         a = Convert.ToDouble(textBox4.Text);
         b = Convert.ToDouble(textBox6.Text);
         c = Convert.ToDouble(textBox5.Text);
         ClassLibrary3.Class1 cc = new ClassLibrary3.Class1(a, b, c);
         textBox8.Text = cc.clac().ToString();
     }
     catch (Exception ex)
     {
         using (FileStream fs = File.Open(Resource1.log, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite))
         {
             using (StreamWriter sw = new StreamWriter(fs))
             {
                 sw.WriteLine(ex.Message);
                 sw.WriteLine(ex.TargetSite);
                 sw.WriteLine(ex.StackTrace);
                 sw.WriteLine(ex.InnerException);
                 sw.WriteLine(ex.HResult);
                 sw.WriteLine(DateTime.Now);
                 sw.Flush();
                 sw.Close();
             }
             fs.Close();
         }
     }
 }
예제 #2
0
        static void Main(string[] args)
        {
            double a, b, c;

            Console.WriteLine("请输入三角形一边边长");
            a = Convert.ToDouble(Console.ReadLine());
            Console.WriteLine("请输入三角形第二边边长");
            b = Convert.ToDouble(Console.ReadLine());
            Console.WriteLine("请输入三角形夹角角度(角度制)");
            c = Convert.ToDouble(Console.ReadLine());
            ClassLibrary2.Class1 cclass = new ClassLibrary2.Class1(a, b, c);
            Console.WriteLine(cclass.clac().ToString());
            double d, e, f;

            Console.WriteLine("请输入三角形一边边长");
            d = Convert.ToDouble(Console.ReadLine());
            Console.WriteLine("请输入三角形第二边边长");
            e = Convert.ToDouble(Console.ReadLine());
            Console.WriteLine("请输入三角形第三边边长");
            f = Convert.ToDouble(Console.ReadLine());
            ClassLibrary3.Class1 cc = new ClassLibrary3.Class1(d, e, f);
            Console.WriteLine(cc.clac().ToString());
            Console.ReadKey();
        }