You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
564 B
28 lines
564 B
#include<iostream>
|
|
#include<math.h>
|
|
using namespace std;
|
|
int main()
|
|
{
|
|
|
|
double a,b,c;
|
|
double v,p;
|
|
cout<<"请输入三角形三条边:"<<endl;
|
|
cin>>a>>b>>c;
|
|
if(a+b>c&&a+c>b&&b+c>a)
|
|
{
|
|
p=(a+b+c)/2;
|
|
v=sqrt(p*(p-a)*(p-b)*(p-c));
|
|
cout<<"该三角形面积是"<<v<<endl;
|
|
if(a==b&&a==c)
|
|
cout<<"该三角形是等边三角形!"<<endl;
|
|
else
|
|
if(a==b&&a!=c||a==c&&a!=b||b==c&&b!=a)
|
|
cout<<"该三角形是等腰三角形!"<<endl;
|
|
if((a*a+b*b==c*c)||(a*a+c*c==b*b)||(c*c+b*b==a*a))
|
|
cout<<"该三角形是直角三角形!"<<endl;
|
|
}
|
|
else
|
|
cout<<"这三条边组不成三角形!"<<endl;
|
|
return 0;
|
|
}
|