给定三条边,判断是否为三角形,如果是,判断是什么三角形
- 不是三角形
- 等腰三角形
- 直角三角形
- 任意三角形
#include<iostream>
using namespace std;
int main()
{
int a, b, c;
cin >> a >> b >> c;
if (a + b <= c || a + c <= b || b + c <= a)
cout << "Not a triangle.";
else if (a == b || a == c || b == c)
cout << "It is an isosceles triangle.";
else if (a*a + b * b == c * c || a * a + c * c == b * b || b * b + c * c == a * a)
cout << "It is a right triangle.";
else
cout << "It is an arbitrary triangle.";
system("pause");
return 0;
}