#include <iostream>
#include <cmath>
using namespace std;
class Triangle
{
public:
float perimeter(void);
float area(void);
void showMessage();
Triangle(float x,float y,float z):a(x),b(y),c(z){}
private:
float a,b,c;
};
void main()
{
Triangle Tri1(7,8,9);
Tri1.showMessage();
}
float Triangle::perimeter(void)
{
return (a+b+c);
}
float Triangle::area(void)
{
float s,m;
s=(a+b+c)/2;
m=sqrt(s*(s-a)*(s-b)*(s-c));
return m;
}
void Triangle::showMessage()
{
cout<<"三角形的三边为: "<<a<<'\t'<<b<<'\t'<<c<<endl;
cout<<"该三角形的周长为:"<<perimeter()<<'\t'<<"面积为:"<<area()<<endl;
}