#include <math.h>
#include <iostream.h>
#include <stdio.h>
void main()
{
double R=206264.8062;double ee=0.006693421622966;double ee1=0.006738525414683;double a=6378245.0;
double B1a,B1b,B1c,x1,y1,H1,B2a,B2b,B2c,x2,y2,H2,D,A1;
cout<<"请输入1点x坐标x1=";cin>>x1;
cout<<"请输入1点y坐标y1=";cin>>y1;
cout<<"请输入1点纬度B1=";cin>>B1a>>B1b>>B1c;
cout<<"请输入1点正常高H1=";cin>>H1;
cout<<"请输入2点x坐标x2=";cin>>x2;
cout<<"请输入2点y坐标y2=";cin>>y2;
cout<<"请输入2点纬度B2=";cin>>B2a>>B2b>>B2c;
cout<<"请输入2点正常高H2=";cin>>H2;
cout<<"请输入实测斜距D=";cin>>D;
A1=atan(y1/x1);
double S,Hm,dh,d,N,RA,Bm,W,Mm,Nm,Rm,ym,dy;
double B1=(B1a*3600+B1b*60+B1c)/R;
double B2=(B2a*3600+B2b*60+B2c)/R;
N=a/(sqrt(1-ee*sin(B1)*sin(B1)));
H1=H1+50.0;H2=H2+50.0;
RA=N/(1+ee1*cos(B1)*cos(B1)*cos(A1)*cos(A1));
dh=H2-H1;Hm=(H1+H2)/2.0;
S=sqrt(D*D-dh*dh)*(1-Hm/RA)+D*D*D/(24*RA*RA);
Bm=(B1+B2)/2.0;
W=sqrt(1-ee*sin(Bm)*sin(Bm));
Mm=a*(1-ee)/(W*W*W);
Nm=a/W;
Rm=sqrt(Mm*Nm);
ym=(y1+y2)/2;
dy=y2-y1;
d=(1+ym*ym/(2*Rm*Rm)+dy*dy/(24*Rm*Rm)+ym*ym*ym*ym/(24*Rm*Rm*Rm*Rm))*S;
cout<<"边长改化结果:"<<endl;
cout<<"归算至椭球面上的大地线长S="<<S<<endl;
cout<<"投影到高斯平面上的边长d="<<d<<endl;
cout<<"A1="<<A1<<endl;
cout<<"RA="<<RA<<endl;
}