注册 登录
编程论坛 新人交流区

[讨论]C++类练习

野郎中 发布于 2007-10-15 22:26, 391 次点击

#include<iostream>
using namespace std;
class V
{ public:
void V_putin();
void V_putout();
private:
float length;
float width;
float height;
float V_v(float,float,float);
}v1,v2,v3;

void main()
{ v1.V_putin();
v1.V_putout();
}

void V::V_putin()
{ cout<<"请输入长方体的长、宽、高:";
cin>>length>>width>>height;
cout<<endl;
}

float V::V_v(float a,float b,float c)
{ float y;
y=a*b*c;
return y;
}

void V::V_putout()
{ cout<<"长、宽、高分别是:"<<length<<','<<width<<','<<height<<endl<<"该长方体的体积是:"<<V_v(length,width,height)<<endl;
}

1 回复
#2
dingpin2007-10-16 11:03
&lt;&lt; 是什么意思呀?
1