c#距离计算、角度转换、前方交会、距离交会程序
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/18 01:35:43
c#距离计算、角度转换、前方交会、距离交会程序
c#距离计算、角度转换、前方交会、距离交会程序
c#距离计算、角度转换、前方交会、距离交会程序
Program:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace 测绘工程
{
class Program
{
static void Main(string[] args)
{
string a;
Console.WriteLine("1:距离计算");
Console.WriteLine("2:度、分、秒转换");
Console.WriteLine("3:度与弧度转换");
Console.WriteLine("4:前方交会");
Console.WriteLine("5:距离交会");
Console.WriteLine(" ");
a=Console.ReadLine();
switch (a)
{
case "1"://计算距离
Distance distance = new Distance();
Console.WriteLine("请输入第一个点位坐标:");
distance.X1 = Convert.ToDouble(Console.ReadLine());
distance.Y1 = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("请输入第二个点位坐标:");
distance.X2 = Convert.ToDouble(Console.ReadLine());
distance.Y2 = Convert.ToDouble(Console.ReadLine());
distance.Calcu();
Console.ReadLine();
break;
case "2"://度、分、秒转换
zhuanhuan zhuanhuan = new zhuanhuan();
string b;
Console.WriteLine("1:度转换为分");
Console.WriteLine("2:度转换为秒");
Console.WriteLine("3:分转换为秒");
Console.WriteLine("4:分转换为度");
Console.WriteLine("5:秒转换为度");
Console.WriteLine("6:秒转换为分");
Console.WriteLine(" ");
b = Console.ReadLine();
switch(b)
{
case "1":
Console.WriteLine("度数:");
double dushu=Convert.ToDouble(Console.ReadLine());
zhuanhuan.A(dushu);
Console.WriteLine("转换后度数为:"+"{0:f4}"+"分",dushu);
Console.ReadLine();
break;
case "2":
Console.WriteLine("度数:");
dushu = Convert.ToDouble(Console.ReadLine());
dushu=(zhuanhuan.A(dushu));
dushu = (zhuanhuan.A(dushu));
Console.WriteLine("转换后度数为:" + "{0:f4}" + "秒", dushu);
Console.ReadLine();
break;
case "3":
Console.WriteLine("分:");
dushu = Convert.ToDouble(Console.ReadLine());
zhuanhuan.A(dushu);
Console.WriteLine("转换后度数为:" +"{0:f4}"+ "秒", dushu);
Console.ReadLine();
break;
case "4":
Console.WriteLine("分:");
dushu = Convert.ToDouble(Console.ReadLine());
dushu = (zhuanhuan.B(dushu));
Console.WriteLine("转换后度数为:" + "{0:f4}" + "度", dushu);
Console.ReadLine();
break;
case "5":
Console.WriteLine("秒:");
dushu = Convert.ToDouble(Console.ReadLine());
dushu = (zhuanhuan.B(dushu));
dushu = (zhuanhuan.B(dushu));
Console.WriteLine("转换后度数为:" + "{0:f4}" + "度",dushu);
Console.ReadLine();
break;
case "6":
Console.WriteLine("秒:");
dushu = Convert.ToDouble(Console.ReadLine());
dushu = (zhuanhuan.B(dushu));
Console.WriteLine("转换后度数为:" + "{0:f4}" + "分", dushu);
Console.ReadLine();
break;
}
break;
case "3":
{
string aa;
double bb;
huduzhi huduzhi = new huduzhi();
Console.WriteLine("1:角度制转换为弧度制");
Console.WriteLine("2:弧度制转换为角度制");
Console.WriteLine(" ");
aa = Console.ReadLine();
if (aa == "1")
{
Console.WriteLine("角度为:");
bb =Convert.ToDouble(Console.ReadLine());
bb=huduzhi.A(bb);
Console.WriteLine("弧度为: "+"{0:f4}",bb);
Console.ReadLine();
}
if (aa == "2")
{
Console.WriteLine("弧度为:");
bb = Convert.ToDouble(Console.ReadLine());
bb=huduzhi.B(bb);
Console.WriteLine("角度为: " + "{0:f4}", bb);
Console.ReadLine();
}
break;
}
case "4":
{
jiaohui jiaohui = new jiaohui();
Console.WriteLine("请输入第一个控制点X坐标:");
jiaohui.XA =Convert.ToDouble(Console.ReadLine());
Console.WriteLine("请输入第一个控制点Y坐标:");
jiaohui.YA =Convert.ToDouble(Console.ReadLine());
Console.WriteLine("请输入第二个控制点X坐标:");
jiaohui.XB =Convert.ToDouble(Console.ReadLine());
Console.WriteLine("请输入第二个控制点Y坐标:");
jiaohui.YB = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("请输入第一个观测方位角(弧度制):");
jiaohui.QBAP = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("请输入第二个观测方位角(弧度制):");
jiaohui.QPBA = Convert.ToDouble(Console.ReadLine());
jiaohui.qianfang();
}
break;
case "5":
{
julijiaohui julijiaohui = new julijiaohui();
Console.WriteLine("请输入第一个控制点X坐标:");
julijiaohui.XA = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("请输入第一个控制点Y坐标:");
julijiaohui.YA = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("请输入第二个控制点X坐标:");
julijiaohui.XB = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("请输入第二个控制点Y坐标:");
julijiaohui.YB = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("请输入第一个控制点与待求点距离:");
julijiaohui.DAP = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("请输入第二个控制与待求点距离:");
julijiaohui.DBP = Convert.ToDouble(Console.ReadLine());
julijiaohui.juli();
}
break;
}
}
}
}