九度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;
}
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;
}
相关文章推荐
- 九度 OJ 1048:判断三角形类型
- 九度OJ 1048:判断三角形类型 (基础题)
- //九度OJ 1048 判断三角形类型
- 九度OJ 1048:判断三角形类型 (基础题)
- 【九度OJ】:1048 判断三角形类型
- 九度王道考研机试 2009-2哈工大1048:判断三角形类型
- 九度-1048-判断三角形类型
- 九度1048 判断三角形类型
- 九度oj-1048-判断三角形类型
- 题目1048:判断三角形类型
- 题目1048:判断三角形类型
- 题目1048:判断三角形类型
- 九度OJ题目1048:判断三角形类型
- 题目1048:判断三角形类型
- 九度1048(判断三角形)
- 九度oj 题目1048:判断三角形类型
- 题目1048:判断三角形类型
- 题目1048:判断三角形类型
- 题目1048:判断三角形类型
- 九度OJ—题目1048:判断三角形类型