[Plain] # include <stdio. h>
# Include <math. h>
# Include <stdlib. h>
Float calculate_perimeter (float x, float y, float z );
Float calculate_area (float x, float y, float z );
Int judge_triangle (float x, float y, float z );
Int judge_righttriangle (float x, float y, float z );
Int judge_isoscelestriangle (float, float y, float z );
Int judge_equilateraltriangle (float x, float y, float z );
Int main ()
{
Float x;
Float y;
Float z;
Scanf ("% f", & x, & y, & z );
If (judge_triangle (x, y, z ))
{
Printf ("The area of a triangle is % f. \ nThe perimeter of a triangle is % f. \ n ",
Calculate_area (x, y, z), calculate_perimeter (x, y, z ));
If (judge_righttriangle (x, y, z ))
{
Printf ("The triangle is right triangle! \ N ");
}
Else
{
Printf ("The triangle is not right triangle! \ N ");
}
If (judge_isoscelestriangle (x, y, z ))
{
Printf ("The triangle is isoscelestriangle! \ N ");
}
Else
{
Printf ("The triangle is not isoscelstriangle \ n ");
}
If (judge_equilateraltriangle (x, y, z ))
{
Printf ("The triangle is equilateraltriangle! \ N ");
}
Else
{
Printf ("The triangle is not equlateraltriangle! \ N ");
}
}
Else
{
Printf ("x, y and z cann't form a triangle! \ N ");
}
System ("pause ");
Return 0;
}
// Definetion of function
// ** Judge triangle
Int judge_triangle (float x, float y, float z)
{
Int flag;
Flag = 0;
If (x + y> z | x + z> y | y + z> x)
{
Flag = 1;
}
Return flag;
}
// ** Calculate perimeter
Float calculate_perimeter (float x, float y, float z)
{
Float perimeter;
Perimeter = x + y + z;
Return perimeter;
}
// ** Calculate area
Float calculate_area (float x, float y, float z)
{
Float s;
Float area;
S = calculate_perimeter (x, y, z)/2;
Area = sqrt (s-x) * (s-y) * (s-z) * s );
Return area;
}
// ** Judge righttriagnle
Int judge_righttriangle (float x, float y, float z)
{
Int flag;
Flag = 0;
If (x * x + y * y = z * z | x * x + z * z = y * y | z * z + y * y = x * x)
{
Flag = 1;
}
Return flag;
}
// ** Judge isoscelestriangle
Int judge_isoscelestriangle (float x, float y, float z)
{
Int flag;
Flag = 0;
If (x = y | x = z | y = z)
{
If (x = y & y = z & x = z)
{
Flag = 0;
}
Else
{
Flag = 1;
}
}
Return flag;
}
// ** Judge equilateraltriangle
Int judge_equilateraltriangle (float x, float y, float z)
{
Int flag;
Flag = 0;
If (x = y & y = z & x = z)
{
Flag = 1;
}
Return flag;
}