#include<stdio.h>
# include <stdlib.h>
# include <math.h>
int test(struct Point *p1,struct Point *p2,struct Point*p3)
{
double x1,x2,x3,y1,y2,y3;
x1=p1->x;
y1=p1->y;
x2=p2->x;
y2=p2->y;
x3=p3->x;
y3=p3->y;
double a=sqrt(pow((y2-y1),2.0)+pow(x2-x1,2.0));
double b=sqrt(pow((y3-y2),2.0)+pow(x3-x2,2.0));
double c=sqrt(pow((y3-y1),2.0)+pow(x3-x1,2.0));
if(a<(b+c)&&b<(a+c)&&c<(a+b))
{
if((a*a)==(b*b)+(c*c)||(b*b)==(a*a)+(c*c)||(c*c)==(a*a)+(b*b))
return 1;
}
else
return 0;
}
main()
{
struct Point *p1,*p2,*p3;
p1->x=6.0;
p2->x=4.0;
p3->x=10.0;
p1->y=1.0;
p2->y=5.0; p3->y=3.0;
printf("%d",test(p1,p2,p3));
}
No comments:
Post a Comment