#include
#include
using namespace std;
class Box {
private:
int length;
int high;
int width;
int v;
int s;
public:
Box(int l, int h, int w) {
length = l;
high = h;
width = w;
}
void volume( ) {
v = length * high * width;
}
void area ( ) {
s = length * high * 2 + length * width * 2 + high * width;
}
void disp ( ) {
cout << "v : " << v << endl;
cout << "s : " << s << endl;
}
};
int main ( ) {
Box b(1, 2, 3);
b.volume( );
b.area( );
b.disp( );
system("PAUSE");
return 0;
}
#include
using namespace std;
class Box
{
int length;
int width;
int height;
public:
Box(int l,int w,int h)
{
length=l;
width=w;
height=h;
}
int volume()
{
return length*width*height;
}
int area()
{
return 2*(length*width+length*height+width*height);
}
void disp()
{
cout<<"volume:"<
};
int main()
{
Box b(2,3,4);
b.disp();
return 0;
}
class club{
private: double length,width,height,volume,area;
public: void getvalue(int &length1,int &width1,int &height1){
if(length1<=0||width1<=0||height1<=0)
stderr<<"输入不大于0"<
}
void volume( ){ volume=length*width*height;}
void area( ){area= 2*(length*width+height*length+width*height);}
void disp( ){cout<
int main(){
club club1;
club1.getvalume(10,20,30);
club1.volume();
club1.area();
club1.disp();
}
#include
class Box
{
public:
Box(int,int,int);
int volume();
int area();
void disp();
private:
int length;
int width;
int heigth;
};
Box::Box(int a,int b,int c)
{
length=a;
width=b;
heigth=c;
}
Box::int volume( )
{
return (length*width*height);
}
Box::int area( )
{
return(length*width*2+length*height*2+height*width*2);
}
Box::void disp()
{cout<
void main()
{
int a.b,c;
cout<<"输入长宽高"<
Box x1(a,b,c);
x1.dsp();
}