#include<iostream>
#include<cmath>
using namespace std;
class s
{
float a,b,c;
public:
void gets();
void countc()
{
cout<<"三角形周长为:";
cout<<(a+b+c)<<endl;
}
void counts();
};
void s::counts()
{
float p;
p=(a+b+c)/2;
cout<<"三角形的面积为:";
cout<<sqrt(p*(p-a)*(p-b)*(p-c))<<endl;;
}
void s::gets()
{
cout<<"请输入三角形三条边:";
cin>>a>>b>>c;
}
int main()
{
s sc;
sc.gets();
sc.countc();
sc.counts();
return 0;
}
#include<cmath>
using namespace std;
class s
{
float a,b,c;
public:
void gets();
void countc()
{
cout<<"三角形周长为:";
cout<<(a+b+c)<<endl;
}
void counts();
};
void s::counts()
{
float p;
p=(a+b+c)/2;
cout<<"三角形的面积为:";
cout<<sqrt(p*(p-a)*(p-b)*(p-c))<<endl;;
}
void s::gets()
{
cout<<"请输入三角形三条边:";
cin>>a>>b>>c;
}
int main()
{
s sc;
sc.gets();
sc.countc();
sc.counts();
return 0;
}