Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - C language: define a function to judge whether three plastic sides can form a triangle, if it is a triangle.
C language: define a function to judge whether three plastic sides can form a triangle, if it is a triangle.
Use C++:

bool judge(int a,int b,int c);

bool judge(int a,int b,int c)

{

if(((a+b)& gt; C) and amp((a+c)>b) and amp ((b+c) >; a))

Return true

other

Returns false

}

int _tmain(int argc,_TCHAR* argv[])

{

int a,b,c;

int e = 1;

And (e)

{

Printf ("enter a, b, c \ n");

Scanf("%d, %d, %d ",& one, & c);

If (judge (a, b, c))

{

if((a * a+b * b)= = c * c)|((a * a+c * c)= = b * b)|((b * b+c * c)= = a * a))

Printf ("Three integers form a triangle, which is a right triangle \ n");

other

Printf ("Three integers form a triangle, but not a right triangle \ n");

}

other

Printf ("Three integers don't make a triangle \ n");

Printf ("Do you want to quit the program? (Please enter 0 to exit, or 1 not to exit): \ n ");

scanf("%d ",& ampe);

}

Returns 0;

}