找个C++高手解决问题

来源:百度知道 编辑:UC知道 时间:2024/05/26 22:20:30
设计一个四边形
要求:1,走狗的可以描述四边形的数据函数成员
2,提供一个算法来计算它的面积
谁能帮我详细的设置出来吗? 好了我悬赏

#include <iostream.h>
#include <time.h>
#include <math.h>
#include <stdlib.h>
//--------------------------------------------------------
class Point
{
public:
Point(){ x=0; y=0; }
double x,y; //点的横纵坐标
};
//---------------------------------------------------------
class Fouredge
{
public:
Fouredge();
void getFouredge(); //产生四边形
double getArea(); //计算面积的成员函数
void display(); //描述四边形的成员函数,用四点坐标描述
private:
Point point[4];
};

//------------------------------------------------------
void main()
{
Fouredge myfouredge;
myfouredge.getFouredge();//生成四边形
myfouredge.display();//显示四点坐标
cout<<"Fouredge's Area is: "<<myfouredge.getArea()<<endl;//输出面积
}

//---------------------------------------------------
Fouredge::Fouredge()
{
}

void Four