1个回答
展开全部
本质上讲,这是一个数学问题
deftype struct point
{
double x;
double y;
};
double get_Area_4(point A,point B,point C,point D)
{
double x_=(A.x+B.x+C.x+D.x)/4;
double y_=(A.y+B.y+C.y+D.y)/4;
return (
(A.x+x_)*(A.y-y_)+
(B.x+x_)*(B.y-y_)+
(C.x+x_)*(C.y-y_)+
(D.x+x_)*(D.y-y_)
)/2;
}
main()
{
printf("请输入4个点坐标,X1,Y1,X2,Y2...");
point a,b,c,d;
scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf"
,a.x,a.y,b.x,b.y,c.x,c.y,d.x,d.y);
printf("四边形的面积是%lf",get_Area_4(a,b,c,d));
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询