# 知道三点坐标求边长夹角C语言编写

#include

#include

main()

{

double Ax1,Ay1,Bx1,By1,Cx1,Cy1,a,b,c,A,B,C;

scanf("%lf%lf%lf%lf%lf%lf",&Ax1,&Ay1,&Bx1,&By1,&Cx1,&Cy1);

a=sqrt((Bx1-Cx1)*(Bx1-Cx1)+(By1-Cy1)*(By1-Cy1));//平方不能使用^这个b=sqrt((Ax1-Cx1)*(Ax1-Cx1)+(Ay1-Cy1)*(Ay1-Cy1));//符号

c=sqrt((Ax1-Bx1)*(Ax1-Bx1)+(Ay1-By1)*(Ay1-By1));

A=acos((b*b+c*c-a*a)/(2*b*c))*180/3.141592654;//是acos而不是arccos B=acos((a*a+c*c-b*b)/(2*a*c))*180/3.141592654;

C=acos((a*a+b*b-c*c)/(2*a*b))*180/3.141592654;

printf("A=%f\nB=%f\nC=%f\n",A,B,C);

printf("a=%f\nb=%f\nc=%f\n",a,b,c);

}

#include

#include

main()

{

double Ax1,Ay1,Bx1,By1,Cx1,Cy1,a,b,c,A,B,C,Az,Bz,Cz;

int Ac,Bc,Cc,i,j,k;

scanf("%lf%lf%lf%lf%lf%lf",&Ax1,&Ay1,&Bx1,&By1,&Cx1,&Cy1);

a=sqrt((Bx1-Cx1)*(Bx1-Cx1)+(By1-Cy1)*(By1-Cy1));//平方不能使用^这个b=sqrt((Ax1-Cx1)*(Ax1-Cx1)+(Ay1-Cy1)*(Ay1-Cy1));//符号

c=sqrt((Ax1-Bx1)*(Ax1-Bx1)+(Ay1-By1)*(Ay1-By1));

A=acos((b*b+c*c-a*a)/(2*b*c))*180/3.141592654;//是acos而不是arccos B=acos((a*a+c*c-b*b)/(2*a*c))*180/3.141592654;

C=acos((a*a+b*b-c*c)/(2*a*b))*180/3.141592654;

Ac=(int)A;

Bc=(int)B;

Cc=(int)C;

Az=(A-floor(A))*60;//floor是去x的整数部分！！

Bz=(B-floor(B))*60;

Cz=(C-floor(C))*60;

i=(int)Az;

j=(int)Bz;

k=(int)Cz;

Az=(Az-floor(Az))*60;

Bz=(Bz-floor(Bz))*60;

Cz=(Cz-floor(Cz))*60;

printf("Bdfm=%d°%d′%f″\n",Bc,j,Bz);

printf("Cdfm=%d°%d′%f″\n",Cc,k,Cz);

printf("A=%f\nB=%f\nC=%f\n",A,B,C);

printf("a=%f\nb=%f\nc=%f\n",a,b,c);

//a,b,c 表示BC,AC,AB的长度;

//A,B,C表示角度。A角度的对边是a····