标题:程序编译错误, 求解!
取消只看楼主
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



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-371599-1-1.html




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

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