| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 495 人关注过本帖
标题:求救,在VC下编译出错。3处错误
只看楼主 加入收藏
sishui198
Rank: 1
等 级:新手上路
帖 子:113
专家分:0
注 册:2007-4-12
收藏
 问题点数:0 回复次数:2 
求救,在VC下编译出错。3处错误
#include<math.h>
#include<iostream.h>
class point
{
private:
     int x,y;
public:
    point (int xx=0,int yy=0)
    {
        x=xx;
        y=yy;
    }
    point (point &p);

    int getx()
    {
        return x;
    }
    int gety()
    {
        return y;
    }
}
point::point(point &p)
{
    x=p.x;
    y=p.y ;
    cout<<p.x;
    cout<<"point 拷贝构造函数被调用"<<endl;
}
class distance
{
private :
    point p1,p2;
    double dist;
public :
    distance(point xp1,point xp2);
    double getdis()
    {
        return dist;
    }
};
    distance::distance(point xp1,point xp2):p1(xp1),p2(xp2)
    {
            cout<<"distance 拷贝构造函数被调用"<<endl;
            double x=double(p1.getx()-p2.getx());
            double y=double(p1.gety()-p2.gety());
            dist =sqrt(x*x+y*y);
    }
void main()
{
    point myp1(1,1),myp2(4,5);

}
搜索更多相关主题的帖子: 编译 
2008-05-14 23:15
sunkaidong
Rank: 4
来 自:南京师范大学
等 级:贵宾
威 望:12
帖 子:4496
专家分:141
注 册:2006-12-28
收藏
得分:0 
#include<math.h>
#include<iostream.h>
class point
{
private:
     int x,y;
public:
    point(int xx=0,int yy=0)
    {
        x=xx;
        y=yy;
    }
    point(point &p);

    int getx()
    {
        return x;
    }
    int gety()
    {
        return y;
    }
};
point::point(point &p)
{
    x=p.x;
    y=p.y ;
    cout<<p.x;
    cout<<"point 拷贝构造函数被调用"<<endl;
}
class distance
{
private :
    point p1,p2;
    double dist;
public :
    distance(point xp1,point xp2);
    double getdis()
    {
        return dist;
    }
};
    distance::distance(point xp1,point xp2):p1(xp1),p2(xp2)
    {
            cout<<"distance 拷贝构造函数被调用"<<endl;
            double x=double(p1.getx()-p2.getx());
            double y=double(p1.gety()-p2.gety());
            dist =sqrt(x*x+y*y);
    }
void main()
{
    point myp1(1,1),myp2(myp1);

}

学习需要安静。。海盗要重新来过。。
2008-05-15 09:17
sishui198
Rank: 1
等 级:新手上路
帖 子:113
专家分:0
注 册:2007-4-12
收藏
得分:0 
谢谢,我知道为什么错了

2008-05-15 14:18
快速回复:求救,在VC下编译出错。3处错误
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018999 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved