您的位置:首页 > 其它

九度oj 1048 判断三角形类型

2012-11-30 23:15 393 查看
#include <iostream>

using namespace std;

int main()

{

double a,b,c,u;

int max;

while(cin>>a>>b>>c)

{

a>b?max=1:max=2;

if(max=1)

a>c?max=1:max=3;

if(max=2)

b>c?max=2:max=3;

if(max==1)

{

u=(b*b+c*c-a*a)/2*b*c;

if(u==0)

{

cout<<"直角三角形"<<endl;

}

else if(u<0)

{

cout<<"钝角三角形"<<endl;

}

else

{

cout<<"锐角三角形"<<endl;

}

}

if(max==2)

{

u=(a*a+c*c-b*b)/2*a*c;

if(u==0)

{

cout<<"直角三角形"<<endl;

}

else if(u<0)

{

cout<<"钝角三角形"<<endl;

}

else

{

cout<<"锐角三角形"<<endl;

}

}

if(max==3)

{

u=(a*a+b*b-c*c)/2*a*b;

if(u==0)

{

cout<<"直角三角形"<<endl;

}

else if(u<0)

{

cout<<"钝角三角形"<<endl;

}

else

{

cout<<"锐角三角形"<<endl;

}

}

}

return 0;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: