这个程序错在哪啊!!
啵呗 2004-02-21 12:38:52 // ex1_2.cpp // 编译预处理
# include"iostream.h"
# include"math.h"
class CPoint //类的定义
{
public:
CPoint(int x,int y) {X=x;Y=y;}
int getX() {return X;}
int getY() {return Y;}
private:
int X,Y;
};
void main() //主函数的设计
{
CPoint p1(3,4),p2(7,3),p3(8,7),p4(6,4),p5(3,8);
double d(CPoint &,CPoint &);
double s;
s=d(p1,p2)+d(p2,p3)+d(p3+p4)+d(p4,p5)+d(p5,p1); //语句部分
cout<<"s="<<s<<endl;
}
double d(CPoint &pa,CPoint &pb) //函数设计
{
int dx,dy;
dx=pa.getX()-pb.getX();
dy=pa.getY()-pb.getY();
double c=sqrt(dx*dx+dy*dy); //语句设计
return c;
}
我找了很久也找不出来, 故来求助啊!!