| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 348 人关注过本帖
标题:程序编译错误, 求解!
取消只看楼主 加入收藏
yang400b
Rank: 2
等 级:论坛游民
帖 子:14
专家分:17
注 册:2012-6-13
结帖率:100%
收藏
已结贴  问题点数:10 回复次数:1 
程序编译错误, 求解!
#include<iostream>
using namespace std;
class rectangle
{    public:
    void area(point t)
    {    cout<<(t.y1-t.y)*(t.x1-t.x)<<endl;  }
};
class point
{   friend rectangle;
    double x,y,x1,y1;
    public:
    point(double a,double b,double c,double d)
    {
        x=a; y=b; x1=c; y1=d;
    }
};
int main()
{  double a,b,c,d;
   cin>>a>>b>>c>>d;
   rectangle t1;
   point t2(a,b,c,d);
   t1.area(t2);
   return 0;
}
5 C:\Documents and Settings\Administrator\桌面\bj.cpp variable or field `area' declared void
5 C:\Documents and Settings\Administrator\桌面\bj.cpp expected `;' before '(' token
7 C:\Documents and Settings\Administrator\桌面\bj.cpp expected `;' before '}' token
9 C:\Documents and Settings\Administrator\桌面\bj.cpp a class-key must be used when declaring a friend
 C:\Documents and Settings\Administrator\桌面\bj.cpp In function `int main()':
22 C:\Documents and Settings\Administrator\桌面\bj.cpp 'class rectangle' has no member named 'area'
搜索更多相关主题的帖子: double Documents include public 
2012-06-15 16:35
yang400b
Rank: 2
等 级:论坛游民
帖 子:14
专家分:17
注 册:2012-6-13
收藏
得分:0 
OK谢谢!
2012-06-15 17:43
快速回复:程序编译错误, 求解!
数据加载中...
 
   



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

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