请各位看看,谢谢
#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 ;
}错在了那里