#include#includeclass base{public:base(){}virtual void area()=0;};class triangle:public base{triangle(float a,float b,float c){x=a;y=b;z=c;}void area(){float p,t_area;p=((x+y+z)/2.0);t_area=(sqrt)(p*(p-x)*(p-y)*(p-z));cout

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/27 05:45:30
#include#includeclassbase{public:base(){}virtualvoidarea()=0;};classtriangle:publicbase{triangle(flo

#include#includeclass base{public:base(){}virtual void area()=0;};class triangle:public base{triangle(float a,float b,float c){x=a;y=b;z=c;}void area(){float p,t_area;p=((x+y+z)/2.0);t_area=(sqrt)(p*(p-x)*(p-y)*(p-z));cout
#include
#include
class base
{
public:
base(){}
virtual void area()=0;
};
class triangle:public base
{
triangle(float a,float b,float c)
{
x=a;
y=b;
z=c;
}
void area()
{
float p,t_area;
p=((x+y+z)/2.0);
t_area=(sqrt)(p*(p-x)*(p-y)*(p-z));
cout

#include#includeclass base{public:base(){}virtual void area()=0;};class triangle:public base{triangle(float a,float b,float c){x=a;y=b;z=c;}void area(){float p,t_area;p=((x+y+z)/2.0);t_area=(sqrt)(p*(p-x)*(p-y)*(p-z));cout
里面的计算可以省略一点
#include
#include
using namespace std;
class base
{
public:
base(){}
virtual void area()=0;
};
class triangle:
public base
{
public:
triangle(float a,float b,float c)
{
x=a; y=b; z=c;
}
void area()
{
float p;
p=((x+y+z)/2.0);
cout