明天要交的作业啊 高手们帮个忙吧!
#include <iostream>#include <cmath>
#include <iomanip>
using namespace std;
const double pi=3.1415926;
void main()
{double x1,x2,x3,y1,y2,y3,a,b,c;
double xp_,yp_,*xp,*yp;
double pA,pB,pC;
cout<<"请输入A点坐标(先输入X再输入Y中间用空格隔开,下同):"<<endl;
cin>>x1>>y1;
cout<<"请输入B点坐标:"<<endl;
cin>>x2>>y2;
cout<<"请输入C点坐标:"<<endl;
cin>>x3>>y3;
double fun1(double x1,double y1,double x2,double y2);
a=fun1(x3,y3,x2,y2);
b=fun1(x1,y1,x3,y3);
c=fun1(x1,y1,x2,y2);
cout<<"边长分别为:"<<endl;
cout<<a<<" "<<b<<" "<<c<<endl;
double fun2(double a,double b,double c);
double A,B,C;
A=fun2(c,b,a);
B=fun2(a,c,b);
C=fun2(a,b,c);
cout<<"三内角分别为:"<<endl;
cout<<A<<" "<<B<<" "<<C<<endl;
double m1,m2,m3,n1,n2,n3;
double m,n,p;
cout<<"请输入角α(度分秒分别输入中间用空格隔开,下同):"<<endl;
cin>>m1>>m2>>m3;
cout<<"请输入角β:"<<endl;
cin>>n1>>n2>>n3;
double fun3(double a,double b,double c);
m=fun3(m1,m2,m3);
n=fun3(n1,n2,n3);
p=2*pi-m-n;
cout<<"观测角为:"<<endl;
cout<<m<<" "<<n<<" "<<p<<endl;
if(m>pi)
{ if(p+n+A-pi<=0.001&&p+n+A-pi>=-0.001) cout<<"危险圆"<<endl;}
else if(n>pi)
{ if(m+p+B-pi<=0.001&&m+p+B-pi>=-0.001) cout<<"危险圆"<<endl;}
else if(p>pi)
{ if(m+n+B-pi<=0.001&&m+n+B-pi>=-0.001) cout<<"危险圆"<<endl;} //以上是对给出的三种危险圆情况的总结
else
{ pA=1/(1/tan(A)-1/tan(m));
pB=1/(1/tan(B)-1/tan(n));
pC=1/(1/tan(C)-1/tan(p));
xp_=(pA*x1+pB*x2+pC*x3)/(pA+pB+pC);
yp_=(pA*y1+pB*y2+pC*y3)/(pA+pB+pC);
xp=&xp_;
yp=&yp_;
}
cout<<"P点坐标为:"<<endl;
cout<<setprecision(7)<<"("<<xp<<","<<yp<<")"<<endl;
}
double fun1(double x1,double y1,double x2,double y2) //由坐标计算边长
{
double a;
a=sqrt(((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)));
return a;}
double fun2(double a,double b,double c)//求内角
{double C;
C=acos((a*a+b*b-c*c)/(2*a*b));
return C;}
double fun3(double a,double b,double c)//角度转化
{double m;
m=pi*(a+b/60+c/60/60)/180;
return m;}
//检验程序的实验参数 M=79°25′24″,N=216°52′04″
//xa=1432.566 ya=4488.226
//xb=1946.723 yb=4463.519
//xc=1923.556 yc=3925.008
//正确的结果是xp=1644.555 yp=4064.458
帮忙抗下吧 明天就要交了