Pages

Wednesday, August 10, 2011

d507. 三角形的判斷


#include
using namespace std;

int main()
{
int a,b,c;
while(cin>>a>>b>>c)
{
int sides[3]={a,b,c};
sort(sides,sides+3);
a=sides[0];
b=sides[1];
c=sides[2];
if( c*c > (a*a+b*b) )
cout<<"obtuse triangle";
else if(c*c < (a*a+b*b) )
cout<<"acute triangle";
else cout<<"right triangle";

}
system("pause");
return 0;
}

No comments:

Post a Comment