#include<iostream>
#include<math.h>
using namespace std;
class triangle{
double a,b,c;
public:
triangle(double x,double y,double z);
~triangle();
void suan();
};
void triangle::suan()
{
double s, q;
if (a+b>c&&a-b<c&&b-a<c)
{
s = (a+b+c)/2;
q=sqrt(s*(s-a)*(s-b)*(s-c));
if(fabs(a-b)<=0.001&&fabs(a-c)<=0.001)
printf("equilateral triangle, %.1lf\n",q);//等边
else if((fabs(a-b)<=0.001&&fabs(a-c)>0.001)||(fabs(a-c)<=0.001&&fabs(a-b)>0.001)||(fabs(b-c)<=0.001&&fabs(a-b)>0.001))
{
if(fabs(a*a+b*b-c*c)<=0.001||fabs(a*a+c*c-b*b)<=0.001||fabs(b*b+c*c-a*a)<=0.001)
printf("isosceles right triangle, %.1lf\n",q);//等腰直角
else printf("isosceles triangle, %.1lf\n",q);//等腰
}
else if (fabs(a*a+b*b-c*c)<=0.001||fabs(a*a+c*c-b*b)<=0.001||fabs(b*b+c*c-a*a)<=0.001)
printf("right triangle, %.1lf\n",q);//直角
else printf("general triangle, %.1lf\n",q);//一般
}
else printf("no triangle\n");//不能
}
triangle::triangle(double x,double y,double z)
{
a = x;
b = y;
c = z;
}
triangle::~triangle(){
a = b = c = 0;
}
int main(){
int t;
cin >> t;
double x, y, z;
while(t--)
{
cin >> x >> y >> z;
triangle p(x,y,z);
p.suan();
}
return 0;
}
点击运行代码之后