Class1.cs
资源名称:Project1.rar [点击查看]
上传用户:tanejiagz
上传日期:2022-06-25
资源大小:12k
文件大小:1k
源码类别:
GPS编程
开发平台:
C#
- using System;
- /// <summary>
- /// Class1 的摘要说明
- /// </summary>
- public class Class1
- {
- const double PI=3.1415926;
- public static void Main()
- {
- double[] arr1, arr2;
- arr1 = new double[2] {30.22787378/180*PI, 120.03308206/180*PI};
- arr2 = new double [2]{30.22786535/180*PI,120.03308391/180*PI};
- double j1 = arr1[0];
- double j2 = arr2[0];
- double w1 = arr1[1];
- double w2 = arr2[1];
- //double d=111.12*Math.Cos(1/(Math.Sin(w1)*Math.Sin(w2)+Math.Cos(w1)*Math.Cos(w2)*Math.Cos(j1-j2)));
- double d2 = 6371229 * Math.Acos((Math.Sin(w1) * Math.Sin(w2) + Math.Cos(w1) * Math.Cos(w2) * Math.Cos(j1 - j2)));
- //Console.WriteLine("两点间的距离是:{0}",d);
- Console.WriteLine("两点间的距离是:{0}",d2);
- }
- }