标题:请各位看看,谢谢
取消只看楼主
longyou2011
Rank: 2
等 级:论坛游民
帖 子:46
专家分:19
注 册:2011-1-12
结帖率:88.24%
已结贴  问题点数:20 回复次数:1 
请各位看看,谢谢
#include<iostream>
using namespace std ;
class Box
{
public :
    Box ()
    {
        length = 1 ; width = 1 ; height = 1 ;

    }
    Box ( float L , float w , float h )
    {
        length = L ; width = w ; height = h ;
    }
    float Surface { return ( length * width + length * height + width * height ) / 2 ; }
    float Volume { return ( length * width * height ) ; }
private :
    float length , width , height ;

} ;
int main ()
{
    Box box1 ( 1 , 2 , 2 ) ;
    Box box2 ( 1 , 2 , 2 ) ;
    cout << " Sourface of box1 is " << box1.Sourface << endl ;
    cout << " Volume of box2 is " << box2.Volume << endl ;
    return 0 ;
}错在了那里
搜索更多相关主题的帖子: private include public return 
2011-01-30 18:27
longyou2011
Rank: 2
等 级:论坛游民
帖 子:46
专家分:19
注 册:2011-1-12
得分:0 
谢谢你的回答
2011-01-30 22:53



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




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

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